DEV Community

Cover image for How to use Symfony messenger to consume RabbitMQ messages (with example)
anastasionico
anastasionico

Posted on

How to use Symfony messenger to consume RabbitMQ messages (with example)

What is Event-Driven Architecture?

The traditional architecture of a system is a classic request/response one.

A service performs an action that involves some other service.

While the second one does its stuff the first need to wait.

That works well but it is not the best way to structure a system.

In an Event-Driven architecture, the flow follows the pattern of events.

When something happens, for instance, an event that requires an action, we store it rather than process it.

In this way, the service we are interacting with does need to stop and wait.

And the second can retrieve the event and perform the action whenever it is ready.

To be able to use this architecture we need to store this event somewhere.

There are several event brokers out there.

The most famous are Apache Kafka, Google Cloud Pub/Sub, and RabbitMQ.

I have already explained in more detail what Event-Driven architecture is.

If you already know enough and want to put your hand in some Symfony code this is the post for you.

In this article, you will learn how to consume messages stored in RabbitMQ using PHP.

We will consume it via Symfony Messenger.

Learn How to use Symfony messenger to consume RabbitMQ messages (with example)

Top comments (0)