Magento 2: Message Queue Status Codes

Magento 2 MESSAGE QUEUE STATUSES

We have created a custom consumer queue. As we have seen, we need to publish the message queue. On publishing a message queue, Magento 2 stores the message queue in the database table queue_message, and Magento 2 defines the status of the message queue in the database table queue_message_status.

But the question is, what kinds of statuses does Magento 2 save in the table queue_message_status? What is the meaning of such status codes in the message queue?

As we have published the message queue. Let’s also check the different status codes and the significance of the message queue.

Magento 2: Message Queue Status Codes

The message queue stores the below status codes in the table queue_message_status. The class QueueManagement is responsible for managing the queues.

const MESSAGE_STATUS_NEW = 2;
const MESSAGE_STATUS_IN_PROGRESS = 3;
const MESSAGE_STATUS_COMPLETE= 4;
const MESSAGE_STATUS_RETRY_REQUIRED = 5;
const MESSAGE_STATUS_ERROR = 6;
const MESSAGE_STATUS_TO_BE_DELETED = 7;

Significant of the message queue status codes

  • The message queue with the status 2 denotes the status “New”.
  • The message queue with the status 3 denotes “In Progress”.
  • The message queue with the status 4 denotes the status “Completed”.
  • The message queue with the status 5 denotes the “Retry Required” status. It is due to the process being stuck due to any runtime issue.
  • The message queue with the status 6 denotes the status “Error”. It means the queue cannot execute due to the error.
  • The message queue with the status 7 denotes the status “Delete”.

That’s it. Magento 2 uses asynchronous tasks of the consumer queue with the help of the statuses mentioned above.

Thanks for reading Post-Magento 2: Message Queue Status Codes. Please subscribe and share with your connections, and yes, please post your suggestions in the comment section.

Download the source code

Note: Please verify the code of this blog and the relevant git repository before using it in production.
sb dev blog adobe commece Magento 2

🙂 HAPPY CODING 🙂

Leave a Reply

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