Understanding external messaging services
Symfony Messenger supports a number of different transport types, including:
- In-memory
- Doctrine
- Redis
- AMQP
- and more.
Typically, you will want to start with the most straightforward options. The in-memory transport is perhaps the simplest one but is mainly used for testing purposes.
The Doctrine transport uses the existing database to store messages. It is often the transport of choice because it is easy to set up and requires no external dependencies.
However, Doctrine shouldn’t be your ultimate solution because using a database as a message queue does not scale well. At some point, you’ll want to use an external message queue system such as RabbitMQ or Redis—intermediaries that give your applications, microservices, and software components a common platform to exchange messages.
In this article, we focus on RabbitMQ, a very popular and mature open-source messaging broker.
Over and above the Doctrine transport built-in to TYPO3, a system like RabbitMQ has several advantages:
- It scales well. RabbitMQ can serve large numbers of message providers and consumers. Applications can connect to each other, as components of a larger application, or to user devices and data. The workload can be distributed across multiple processes.
- Support for distributed systems. RabbitMQ can run message brokers on multiple nodes to distribute workload to a network of services and route messages between producers and consumers.
- Fault-tolerant by design. Messages are stored in a queue until they get consumed. The queue can absorb load spikes and store messages in case one or more consumers are temporarily unavailable.
Those advantages make it worth investing time to set up an external message transport for TYPO3. If you want to try out RabbitMQ, read on to see how to create a DDEV-based message queue project.