Symfony how to use Mercure with Messenger + RabbitMQ?

I am looking to use Mercury with RabbitMQ. This is the first time that I have used Mercury as well as RabbitMQ so I am not yet good.

Here is where I am:

I’ve installed Mercure, and Messenger.


        # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
        failure_transport: failed

             async: '%env(MESSENGER_TRANSPORT_DSN)%'
             failed: '%env(MESSENGER_TRANSPORT_FAILED_DSN)%'
            # sync: 'sync://'

            # Route your messages to the transports
            # 'AppMessageYourMessage': async


MESSENGER_TRANSPORT_DSN=amqp://bastien:[email protected]:5672/%2f/messages
MESSENGER_TRANSPORT_FAILED_DSN=amqp://bastien:[email protected]:5672/%2f/failed

And in my controller I simulated 50 pings on a URL of my local app:

     * @Route("/ping", name="ping", methods={"POST"})
    public function ping(MessageBusInterface $bus)
            $update = new Update("", "[]");
        return $this->redirectToRoute('home');

I have successfully started my instance of Mercury as well as that of Messenger which is therefore well connected to my RabbitMQ.

But when I test sending the pings, it works, but without going through my RabbitMQ. Did I miss something? I think of my Messenger.yaml in the routing part but I don’t know what to put if it is the case

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *