Repeatable Jobs ======================== | There are cases where a procedure needs to be repeated over time, regardless of whether it is completed successfully or not. | This can be accomplished through special jobs called `RepeatableJob`. | Let's see how to use them through an example. | | Suppose we want to send a report to a specific email address every day at 06:00 UTC. | We will need to :ref:`create our Workable` that contains the procedure to generate/send the report. We proceed, as seen before, to implement the |recruiter.workable.class|_ class using the |recruiter.workable-behaviour.class|_ trait to avoid writing redundant code. .. code-block:: php `_ daemon. | Therefore, to send our report every day at `06:00 UTC`, we need to do this: .. code-block:: php asRepeatableJobOf($this->recruiter) ->repeatWithPolicy($schedulePolicy) ->retryWithPolicy(new DoNotDoItAgain()) // this is the default behaviour ->create() ; | To remove an active scheduler, you can use the console command `scheduler:remove` and follow its instructions. .. code-block:: bash $ php vendor/bin/recruiter scheduler:remove --target 127.0.0.1:27017 .. |recruiter.workable.class| replace:: ``Recruiter\Workable`` .. _recruiter.workable.class: https://github.com/recruiterphp/recruiter/blob/master/src/Recruiter/Workable.php .. |recruiter.repeatableJob.class| replace:: ``Recruiter\Repeatable`` .. _recruiter.repeatableJob.class: https://github.com/recruiterphp/recruiter/blob/master/src/Recruiter/Repeatable.php .. |recruiter.workable-behaviour.class| replace:: ``Recruiter\WorkableBehaviour`` .. _recruiter.workable-behaviour.class: https://github.com/recruiterphp/recruiter/blob/master/src/Recruiter/WorkableBehaviour.php .. |recruiter.schedule-policy.class| replace:: ``Recruiter\SchedulePolicy`` .. _recruiter.schedule-policy.class: https://github.com/recruiterphp/recruiter/blob/master/src/Recruiter/SchedulePolicy.php .. |recruiter.cron.class| replace:: ``Recruiter\SchedulePolicy\Cron`` .. _recruiter.cron.class: https://github.com/recruiterphp/recruiter/blob/master/src/Recruiter/SchedulePolicy/Cron.php