From c696b0e6302c103ef713b016473cae38d14ded03 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 16 Jan 2024 15:50:06 +0100 Subject: [PATCH] [Scheduler] List existing triggers --- scheduler.rst | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/scheduler.rst b/scheduler.rst index 3d89f7c4bc3..9b532d69dc8 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -133,6 +133,26 @@ Scheduling Recurring Messages A ``RecurringMessage`` is a message associated with a trigger, which configures the frequency of the message. Symfony provides different types of triggers: +:class:`Symfony\\Component\\Scheduler\\Trigger\\CronExpressionTrigger` + A trigger that uses the same syntax as the `cron command-line utility`_. + +:class:`Symfony\\Component\\Scheduler\\Trigger\\CallbackTrigger` + A trigger that uses a callback to determine the next run date. + +:class:`Symfony\\Component\\Scheduler\\Trigger\\ExcludeTimeTrigger` + A trigger that excludes certain times from a given trigger. + +:class:`Symfony\\Component\\Scheduler\\Trigger\\JitterTrigger` + A trigger that adds a random jitter to a given trigger. This allows to + distribute the load of the scheduled tasks instead of running them all + at the same time. + +:class:`Symfony\\Component\\Scheduler\\Trigger\\PeriodicalTrigger` + A trigger that uses a ``DateInterval`` to determine the next run date. + +Most of them can be created via the :class:`Symfony\\Component\\Scheduler\\RecurringMessage` +class, as we'll see in the following examples. + Cron Expression Triggers ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -140,7 +160,7 @@ It uses the same syntax as the `cron command-line utility`_:: RecurringMessage::cron('* * * * *', new Message()); -Before using it, you must install the following dependency: +Before using it, you have to install the following dependency: .. code-block:: terminal @@ -224,7 +244,7 @@ Then, define your recurring message:: new SendDailySalesReports('...'), ); -Finally, the recurring messages must be attached to a schedule:: +Finally, the recurring messages has to be attached to a schedule:: // src/Scheduler/MyScheduleProvider.php namespace App\Scheduler;