Skip to main content

Messenger! Queue work for Later

5h 5m 31s
English
Paid

Symfony's Messenger component offers a robust system for structuring your code around "message" objects and decoupled "handlers," allowing for asynchronous execution through queues and workers. It’s a powerful feature designed to streamline various processes.

Introduction to Symfony Messenger

The Messenger component, one of Symfony's latest innovations, is quickly gaining love from developers. This tutorial will guide you through creating an application that asynchronously adds our favorite cat, Ponka, to all of your cherished photos. Through this engaging project, you’ll learn to master the Messenger component.

What You Will Learn

By following this tutorial, you will acquire the skills to:

  • Create message classes
  • Build and configure "handler" classes to perform specific tasks
  • Dispatch messages through the message bus
  • Configure "transports" for managing asynchronous messages
  • Route messages to their designated transports
  • Execute "worker" processes that handle queued messages
  • Manage failure scenarios by retrying messages and setting up a "failure transport"
  • Integrate and utilize middleware for message handling
  • Apply and understand message stamps for advanced message handling
  • Set up prioritized transports for optimal message routing
  • Introduce a bit of CQRS with a Query bus
  • Test and develop by handling messages synchronously
  • Streamline deployment with supervisor and related tools
  • Work with RabbitMQ and AMQP for effective message brokering

Get Started

Let’s dive into the world of Symfony Messenger and get to work on building an efficient, asynchronous message processing system!

About the Author: symfonycasts

symfonycasts thumbnail
Woh, hey! I'm Ryan - the lead trainer and one of your friends here at SymfonyCasts. Look, I love being a developer, but the road to becoming a productive programmer is not easy. When I started, good information was buried by theory and real-world examples were non-existent. There's a great developer stuck inside each of us! And in 2011, I started SymfonyCasts (formerly: KnpUniversity) to help more people discover and unlock that potential by using better methods of learning. Being the documentation lead for a massive open source project (Symfony), a frequent speaker and an in-person trainer for 5 years has helped us craft our strict philosophy for real, significant learning. Build real-world projects from end-to-end, via beautiful video tutorials NEVER use slides (gross!) Have some fun! We promise energy, space-ship animations, and embarrassing (I mean intelligent) jokes Practice, practice, practice using our realistic coding challenges. Then enjoy a sandwich! Keep things simple and save the heroically difficult details for later (or never!) Now, it's your turn. So suit up (pajamas are the official uniform), get ready to work hard, and finally awaken the amazing developer that's hiding inside of you!

Watch Online 48 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 48 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Installing Messenger
All Course Lessons (48)
#Lesson TitleDurationAccess
1
Installing Messenger Demo
06:15
2
Message, Handler & the Bus
08:36
3
Doing Work in the Handler
06:33
4
Message, Handler & debug:messenger
05:52
5
Transport: Do Work Later (Async)
07:33
6
Worker Command
05:34
7
Problems with Entities in Messages
04:54
8
Passing Entity Ids inside of Messages
08:01
9
Dispatching a Message inside a Handler?
05:30
10
Partial Handler Failures & Advanced Routing
04:36
11
Envelopes & Stamps
06:24
12
Retrying on Failure
05:11
13
Retry Delay & Retry Strategy
04:41
14
The Failure Transport
05:37
15
Investigating & Retrying Failed Messages
05:42
16
Middleware
05:59
17
Tracking Messages with Middleware & a Stamp
05:31
18
Logger Channel Setup and Autowiring
05:27
19
Middleware Message Lifecycle Logging
07:48
20
High Priority Transports
05:41
21
Handling Messages Sync while Developing
05:54
22
Functional Test for the Upload Endpoint
09:23
23
Testing with the "in-memory" Transport
05:26
24
Deployment & Supervisor
09:08
25
Killing Workers Early & on Deploy
05:55
26
Events & Event Bus
05:23
27
Creating & Handling Events
07:55
28
Dispatching the Event & No Handlers
07:07
29
Messenger vs EventDispatcher
03:19
30
Doctrine Transaction & Validation Middleware
05:59
31
Event & Command Bus Organization
07:23
32
Query Bus
08:48
33
Advanced Handler Config: Handler Subscribers
07:59
34
Sending Handlers to Different Transports: from_transport
03:22
35
AMQP with RabbitMQ
07:22
36
AMQP Internals: Exchanges & Queues
08:11
37
AMQP Priority Exchange
07:16
38
Delaying in AMQP: Dead Letter Exchange
07:23
39
Exchange Routing and Binding Keys
06:39
40
Dynamic AMQP Routing Key (AmqpStamp)
07:51
41
Serializing Messages as JSON
06:41
42
JSON, Message Headers & Serializer Options
03:15
43
Setup for Messages from an Outside System
06:01
44
Transport for Consuming External Messages
05:51
45
Custom Transport Serializer
06:34
46
The Lifecycle of a Message & its Stamps
08:17
47
Graceful Failure in the Transport Serializer
04:48
48
Mapping Messages to Classes in a Transport Serializer
04:56
Unlock unlimited learning

Get instant access to all 47 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription