diff --git a/guides/hosting/infrastructure/scheduled-task.md b/guides/hosting/infrastructure/scheduled-task.md index 1130fddc0..52e88f5ce 100644 --- a/guides/hosting/infrastructure/scheduled-task.md +++ b/guides/hosting/infrastructure/scheduled-task.md @@ -60,6 +60,25 @@ You can use the flag `--no-wait` and run the command from an operating system sc */5 * * * * /usr/bin/php /var/www/html/bin/console scheduled-task:run --no-wait ``` +## Using the symfony scheduler to run tasks + +::: info +Running tasks with the symfony scheduler is available starting with Shopware 6.6 +::: + +::: warning +This feature is experimental. +::: + +You can run scheduled tasks as part of your queue workers with the help of the symfony scheduler component. + +``` bash +bin/console messenger:consume scheduler_shopware +``` + +On startup of this command reads the `scheduled_task` database table and applies the stored intervals, an entry in this table is optional. In the event that these intervals are modified in the database, it is necessary to restart the command for the updated intervals to take effect. +To deactivate tasks, set status to `Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskDefinition::STATUS_INACTIVE` in this table, and restart the `consume` command. + ## Debugging scheduled tasks You can directly run a single scheduled task without the queue. This is useful for debugging purposes or to have better control of when and which tasks are executed. You can use `bin/console scheduled-task:run-single ` to run a single task. Example: