Magento Commerce comes with a RabbitMq integration.

I'm trying to publish smth in RabbitMq. I'm following the docs on this.

Problem: I get the following exception:

Fatal error: Uncaught PhpAmqpLib\Exception\AMQPProtocolChannelException: NOT_FOUND - no exchange 'vulpea-test' in vhost '/' in /var/www/magento/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php on line 191

Looking in RabbitMq the exchange does not exist. But Magento Should create it when making the request. If I create the exchange by hand the exception does not appear anymore yet messages are not published either way.

Note: I can consume queues successfully. And I have no errors at setup:di:compile.


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd">
    <broker topic="vulpea.test" type="amqp" exchange="vulpea-test">


namespace Vulpea\Test\Controller\Test;

use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\MessageQueue\PublisherInterface;
use Vulpea\Test\Model\Message;

    class Rabbit extends \Magento\Framework\App\Action\Action
        protected $publisher;

        public function __construct(
            PublisherInterface $publisher,
            Context $context
            $this->publisher = $publisher;

         * Dispatch request
         * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
         * @throws \Magento\Framework\Exception\NotFoundException
        public function execute()
                $message = new Message();

                $this->publisher->publish("vulpea.test", $message);
            }catch (\Exception $exception){

            var_dump("It works");

Any pointers are welcomed. Thanks

2 Answers 2


Ok. So it turns out that exchanges,queues etc. are created only when setup:upgrade command is run.

If you arrive here, you might want to write that down because it's not mentioned in the docs (Or at least I could not find it anywhere).

  • 1
    it doesn't work for me, exchange is still not created Commented Mar 8, 2022 at 7:45
  • Hi there, it worked for me , i just recently fired all the docker containers in my local machine and was getting this error , but after s:up the error is no more.Thanks. Commented Oct 9, 2023 at 12:04

I was clueless on the error and was struggling to find the answer. Adding the problem here so that someone searching for similar problem will be able to find it. Thanks to vitoriodachef for the solution :

=INFO REPORT==== 3-Sep-2018::13:34:12 === accepting AMQP connection <0.1267.0> ( ->

=ERROR REPORT==== 3-Sep-2018::13:34:12 === Channel error on connection <0.1267.0> ( ->, vhost: '/', user: 'admin'), channel 1: operation basic.publish caused a channel exception not_found: "no exchange 'magento' in vhost '/'"

=INFO REPORT==== 3-Sep-2018::13:34:12 === closing AMQP connection <0.1267.0> ( ->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.