Symfony's Messenger component gives you a beautiful system for designing your code around "message" objects and decoupled "handlers" that do the work!
... wait... that's not right, it's really...
Symfony's Messenger component gives you the power to execute code asynchronously via queues and workers!
Actually, it's both! Messenger is one of the newest parts of Symfony and we absolutely ❤️ it. In this tutorial, we'll create an important application that asynchronously adds our favorite cat (Ponka) to all of your favorite photos. Along the way, we'll learn to:
- Create a messages classes
- Add & configure "handler" classes that do the work
- Dispatch messages through the bus
- Configure "transports" for async messages
- Route messages to transports
- Execute "worker" processes that "consume" queued messages
- Things fail!? Retry message and set up the "failure transport"
- Middleware
- Add & understand message stamps
- Prioritized transports
- A little CQRS: a Query bus
- Testing & Dev: handling messages "sync"
- Deployment and supervisor
- RabbitMQ & AMQP
Let's get to work!