0% found this document useful (0 votes)
115 views7 pages

What Is Rabbit MQ

RabbitMQ is a message queueing system that allows processes called producers to send messages to queues that are then retrieved by consumer processes. Magento has built-in support for RabbitMQ to asynchronously process tasks like creating new users, generating PDFs from orders, and distributing large data processing across multiple consumers for scaling. This allows operations to complete without blocking the customer and improves performance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views7 pages

What Is Rabbit MQ

RabbitMQ is a message queueing system that allows processes called producers to send messages to queues that are then retrieved by consumer processes. Magento has built-in support for RabbitMQ to asynchronously process tasks like creating new users, generating PDFs from orders, and distributing large data processing across multiple consumers for scaling. This allows operations to complete without blocking the customer and improves performance.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

What is RabbitMQ?

• Standalone program that runs on a webserver


• Message queueing system that acts like a digital post office
• Processes called Producers send messages to RabbitMQ, addressed to specific queue
• Another process called a Consumer requests the information from a specific queue
• The Consumer processes the message as needed

Magento Commerce has built-in support for RabbitMQ!


Magento/ERP Data Sync
Creating a new user in Magento
• Magento will produce a message with a data payload that
describes the new user's account data. JSON is well suited
for this.
• Producer sends this message to RMQ, and specifies that it
is to go into the user.create queue
• The ERP runs a consumer which finds the message in the
user.create queue, creates the user, acknowledges the
messages has been processed, and RMQ then removes it.

This can be done for any operation.

Benefit: asynchronous processing of data, rather than forcing


the customer to wait while Magento contacts the ERP and
sends the data
Queued Data Processing Requests

• Producer in Magento sends the order ID and other relevant information to a queue
• Consumer pulls messages from that queue and generates the appropriate PDFs

The single-threaded nature of consumers means that only one PDF at a time will be generated, and in the order that the
request was received. This can be used for converting quotes to orders, zipping large data files, generating images, etc
Distributed Data Processing
RMQ consumers are single-threaded and can only process one message at a time.
To scale up:
• Multiple consumers can access the same queue
• Depending on server resources, many consumers can be spawned to handle the same processes
Options for Consumers
Run on a schedule
• Cron is used to trigger the consumer on a schedule
• Consumer can consume all messages in the queue, or be set to keep running until a limit is reached

Run continuously
• Supervisor is used to start the consumers and ensure they keep running
• Consumers are set to keep running until they consume a certain number of messages
• Once the limit is reached, the consumer stops and supervisor restarts it
Resources
RabbitMQ beginner’s guide:
https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for-
beginners-what-is-rabbitmq.html

CloudAMQP Documentation
https://www.cloudamqp.com/docs/index.html

Magento dev guide:


https://devdocs.magento.com/guides/v2.3/extension-dev-
guide/message-queues/message-queues.html

You might also like