Skip to main content
CF

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

SymfonyCasts (formerly KnpUniversity) is a US-based PHP / Symfony training platform run by Ryan Weaver, a Symfony core team member. The platform is the closest thing to an official video-tutorial source for the Symfony framework — Ryan's tutorials are the path most working Symfony developers learned the framework through.

The CourseFlix listing carries five SymfonyCasts titles: Symfony 5 Fundamentals — Services, Config & Environments, API Platform — Serious RESTful APIs, Messenger! Queue Work for Later, phpspec — Testing / Designing with a Bite, and the SymfonyCon 2018 Lisbon Conference Videos. Material is paid and aimed at PHP developers building production Symfony applications.

For broader content, see CourseFlix's Symfony and PHP category pages where SymfonyCasts material sits alongside the wider PHP teaching community.

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

Related courses

Frequently asked questions

What prerequisites should I have before taking this course?
Before starting this course, you should have a basic understanding of PHP and experience working with Symfony as the Messenger component is part of the Symfony framework. Familiarity with concepts like message queues and asynchronous processing will be beneficial, though not strictly necessary as these are covered in the course through practical examples.
What is the main project or application built in this course?
The primary project in this course involves creating an application that asynchronously adds the cat Ponka to your photos. This project serves as a hands-on exercise in mastering the Symfony Messenger component, teaching you how to create message classes, configure handlers, and manage asynchronous execution through queues and workers.
Who is the target audience for this course?
This course is intended for developers who are already familiar with Symfony and are looking to expand their skills in asynchronous processing and message handling. It's particularly suitable for those interested in learning how to implement the Messenger component to streamline processes and manage task queues effectively.
How does the depth of this course compare to other courses on Symfony components?
This course provides a focused exploration of the Symfony Messenger component, covering advanced topics such as message handling with middleware, managing failure scenarios, and working with RabbitMQ. It offers a deep dive into asynchronous messaging within Symfony, which may not be covered as extensively in more general Symfony courses.
What specific tools or platforms are integrated into the course?
The course integrates RabbitMQ and AMQP, providing detailed lessons on using these tools for effective message queuing and asynchronous processing. You will learn about AMQP internals, exchanges, queues, and priority handling, as well as how to delay messages using the Dead Letter Exchange.
What topics are explicitly not covered in this course?
While the course covers numerous aspects of the Symfony Messenger component, it does not delve into other Symfony components unrelated to messaging. It also does not cover front-end development or user interface design, as its focus is on back-end processing and message handling.
How much time should I expect to commit to this course?
The course consists of 48 lessons, each designed to build on the previous one. Although the total runtime is not specified, you should plan to dedicate several hours per week to go through the lessons, complete exercises, and understand the advanced concepts of the Messenger component, such as middleware and message routing.