1

I am getting an error while publishing a message to RabbitMQ :The connection timed out after 3 sec while awaiting for incoming data.

use Magento\Framework\MessageQueue\PublisherInterface;

$this->publisher->publish('watcher_order_attribute.update', $this->serializer->serialize($publishData));

COMMUNICATION.XML

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
    <topic name="watcher_order_attribute.update" request="string" />
</config>

queue_topology.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
    <exchange name="magento" type="topic" connection="amqp">
        <binding id="uniqueIdBinding" topic="watcher_order_attribute.update" destinationType="queue" destination="WatcherQueue"/>
    </exchange>
</config>

queue_consumer.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
    <consumer name="vendor.WatcherQueue" queue="WatcherQueue" connection="amqp"  consumerInstance="Magento\Framework\MessageQueue\Consumer" handler="Vendor\MyQueue\Model\Watcher\Attribute\Consumer::process" />
</config>

queue_publisher.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
    <publisher topic="watcher_order_attribute.update">
        <connection name="amqp" exchange="magento" />
    </publisher>
</config>
'amqp' => [
            'host' => '127.0.0.1',
            'port' => '15672',
            'user' => 'guest',
            'password' => 'guest',
            'virtualhost' => '/'
        ]

1 Answer 1

1

Can you please update your app/etc/env.php file code, and set the below code.

'queue' => [
        'amqp' => [
            'host' => '127.0.0.1',
            'port' => '5672',
            'user' => 'guest',
            'password' => 'guest',
            'virtualhost' => '/'
        ]
    ]

Let me know it works. Actually, You have set the wrong port.

Note: After updating run the basic CLI command.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento  setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
1
  • I am getting the same error, I tried your given solution as well. unfortunately, it not working in my case. any other idea for same. Jan 31, 2022 at 5:24

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.