Define CronJob, Job, and Trigger, as well as the JobPerformable?

CronJobJob, and Trigger, as well as the JobPerformable class which is tightly related to the Job type.

  • Job type describes the logic to be executed, defined by an associated JobPerformable
  • CronJob type holds the configuration for a single run of a Job, as well as the protocol information, like logs
  • Trigger type is used for scheduling when to run a Job.

Summarizing, a Job defines what should be done, a Trigger says when, and a CronJob specifies the setup used by Job.

The division into CronJobJob/JobPerformable, and Trigger types allows to reuse the code. For example, you may create a database backup as a Job several times using Trigger at different locations as CronJob without coding the actual backup logic twice.

 


No comments:

Post a Comment