Skip to content

[Scheduler] List existing triggers #19428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Scheduler] List existing triggers
  • Loading branch information
alexandre-daubois committed Jan 16, 2024
commit c696b0e6302c103ef713b016473cae38d14ded03
24 changes: 22 additions & 2 deletions scheduler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,34 @@ 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
~~~~~~~~~~~~~~~~~~~~~~~~

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

Expand Down Expand Up @@ -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;
Expand Down