Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Here we will learn how to configure and use RabbitMQ in Magento 2.3

    What is  RabbitMQ you can check it here.

    Step 1# For configure RabbitMQ in Magento to you need to add RabbitMQ details in Magento env.php file

    env.php file location in magento :  magento-root-dir/app/etc/env.php


    Now after configuration we will use RabbitMQ in our Custom Module

    For this we need to create following four files in our module etc folder

    location of etc folder in your module : magento-root/app/code/NameSpace/ModuleName/etc

    Step 2# 1st we will create communication.xml in magento-root/app/code/NameSpace/ModuleName/etc folder

    This file Contains a list of topics. Which are Intended to contain message queue information shared between implementations.

    Step 3# create queue_topology.xml in magento-root/app/code/NameSpace/ModuleName/etc folder

    This file define the message routing rules and declares queues and exchanges.

    Step 4# create queue_consumer.xml in magento-root/app/code/NameSpace/ModuleName/etc folder

    This file define the relationship between an existing queue and its consumer.

    Step 5# create queue_publisher.xml in magento-root/app/code/NameSpace/ModuleName/etc folder

    This file defines which connection and exchange to use to publish messages for a specific topic.

    Now i will login in RabbitMQ panel and check queue list

     

    There are no Queues in panel now i will install our module in magento


     

    After installation we got our queue in RabbitMQ panel as follow

     

    Our queue “yourQueue” added in RabbitMQ now we will write code for publish message in this our queue

    Step 6# Here  i will create a controller from which i will add message in our Queue

    create file : NameSpace\ModuleName\Controller\Adminhtml\PublishMessage\InRabbitMQ.php

    Step 7# Now we will create consumer class for process queue message

    create file: NameSpace\ModuleName\Model\MassConsumer.php

    Step 8# Now we will check our consumer from terminal

    Run following command from magento root directory


    After run above command you will get following result on terminal

     

    Step 9# Now for run consumer we need to execute following command from terminal


    For  run this process in backend you need to add “&” in above command as following


    Thank you  🙂

     

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close