We are going to discuss the RabbitMQ Message Queue and its implementation using .NET Core 6 API as a message producer and the console application as a message consumer.
Join the DZone community and get the full member experience.
We are going to discuss the RabbitMQ Message Queue and its implementation using .NET Core 6 API as a message producer and the console application as a message consumer.
As you can see in the above diagram, there is one producer which sends a message to the RabbitMQ server and the server will store that message inside the queue in a FIFO manner.
The producer sent the message to the queue so that there may be multiple consumers which want the message produced by the producer. In that case, consumers subscribe to the message and get that message from the Message Queue, as you can see in the above diagram.
In this section, we will take one eCommerce site as an example to help us understand.
There are multiple microservices that are running in the background while we are using the eCommerce website. There is one service that takes care of order details, and another service that takes care of payment details and receipts.
Suppose we place one order at the time the order service will start, and process our order. After taking the order details, it will send data to the payment service, which takes the money and send the payment receipt to the end users.
In that case, there might be a chance of some technical issue happening in the payment service. If the user did not get the payment receipt due to this, the user is impacted, and connects with the support team to try to get the status of the order.
Also, there might be another scenario on the user (consumer) side. In this case, due to some technical issue, the user exits the application when the payment is in process, but they did not get any receipt details after payment is successfully done from the back-end services.
So, in these scenarios, the RabbitMQ plays a very important role in persisting messages in the message queue. When the consumer gets online, they receive that order receipt message from the message queue, which is produced by the producer without impacting the web application.