In my application I have a set of jobs to execute:
- Each job goes through the states "not started", "started", "completed", "failed" etc.
- Each job has a set of pre-conditions and post-conditions.
- Job cannot start until the preconditions are satisfied and should be marked as failed if it doesn't satisfy the post conditions.
For example let's say the job imports a text file into the database. Pre-condition would be to check if the source file exists and post-condition would be to check if data exists in database. On top of these pre and post-conditions, sometimes job is also dependent on other jobs to finish. It is easy to create a jobs table and have a dependency table for jobs, but is it actually possible to make these pre and post validation checks to be configurable in database (so that no code changes need to be made if these conditions change or new conditions are added)?
Even if it is possible somehow, is it a good idea to do so? There is a requirement to make this model generic so that other applications can also make use of it even if the validation checks to be performed are entirely different for other applications.