Des nouvelles ont été ajoutées en tête de listes.
Remontez pour les voir.
Inscription à la newsletter
Master task scheduling with Symfony Scheduler
JoliCode - JoliCodeBlog -
06/12
Introduction Nowadays, using a crontab for our recurring tasks is quite common, but not very practical because it's completely disconnected from our application. The Scheduler component is an excellent alternative. It was introduced in 6.3 by Fabien Potencier during his opening keynote
Cet article est aussi disponible en 🇫🇷 Français : Maîtrisez la planification des tâches avec Symfony Scheduler.
Section intitulée introductionIntroduction
Nowadays, using a crontab for our recurring tasks is quite common, but not very practical because it’s completely disconnected from our application. The Scheduler component is an excellent alternative. It was introduced in 6.3 by Fabien Potencier during his opening keynote at SymfonyLive Paris 2023 (french publication). The component is now considered stable since the release of Symfony 6.4. Let’s take a look at how to use it!
As all the component’s functionalities are based on Messenger, we need to install it too.
Section intitulée the-first-taskThe first task
Let’s create a first message to schedule:
// src/Message/Foo.php readonly final class Foo {} // src/Handler/FooHandler.php #[AsMessageHandler] readonly final class FooHandler { public function __invoke(Foo $foo): void { sleep(5); } }
In the same way as a Message dispatched in Messenger, here we’re dispatching a Message, which Scheduler wi... [Courte citation de 8% de l'article original]
Loading...
🍪
Le modèle économique de notre site repose sur l'affichage de publicités personnalisées basées sur l'utilisation de cookies publicitaires. En continuant votre visite sur notre site, vous consentez à l'utilisation de ces cookies.
Politique de confidentialité