![]() Since this is a client facing, business oriented application, we should ensure that the Order always get stored in the memory and doesnt fail / get lost at any point of time. This defeats the purpose of having a Microservice architecture. So, why RabbitMQ in this scenario? Can’t we Directly POST to the OrderProcessing Microservice? No. These details will finally be stored to a database and the user will be notified by email of the order state. The ticket details would be sent to a RabbitMQ Queue, which would later be consumed by the OrderProcessing Microservice. Internally, this generates a POST request from the Ticket Microservice. The user buys a tickets via the front-end. We will have 2 Microservices with RabbitMQ connection for communication. Let’s mimic a ticketing application where the user can book his/her ticket. Even if all the consumers are offline, the messages are still in RabbitMQ waiting for the consumers to come online and take the message off their particular queues. This does not in any way affect the integrity of the system. Here consumer #3 is offline for a specific time. Here is a simple demonstration of work-flow in a basic RabbitMQ setup. Once the Service comes online, it consumes the pending messages and processes it. Higher availability – Even if the main Microservice is down to a technical glitch on on-going update, the messages are never lost.Clean User Experience – You users are less likely to see any errors, thanks to the microservice based message broker architecture.This is quite easy with the queue concept in RabbitMQ. When it get’s to the point where you first server finds it tough to process the incoming queue data, you can simply add another server that can share the load and improve the overall response time. Better Scalability – Now, you will not have to depend on just one VM / processor / server to process your request.There are quite a lot of advantages of using a queue based messaging solution rather that directly sending messages to the intendend consumer. We will be setting up this too later in this article! Advantages of RabbitMQ An application can act as both producer / consumer based on how you configure it and what the requirement demands.Īdditional, RabbitMQ provides a cool Dashboard for monitoring the messages and queues. ![]() Whenever there is a new message, each of the subscibers would receive it. To this particular queue, multiple consumers can subscribe. Now the server stores the message in a queue. In simple words, you will have a publisher that publishes messages to the message broker (RabbitMQ Server). RabbitMQ makes the entire process seemless. This ensures that your messages (data) is never lost and is successfully received by each intended consumer. It basically gives your applications a common platform for sending and receiving messages. RabbitMQ is one of the most popular Message-Broker Service. Consider supporting me by buying me a coffee.Scenario #1 – When the Consumer is Online.Setting up the the Consumer Microservice.Installing the Required MassTransit Packages.Setting up the the Publisher Microservice.Getting Started – RabbitMQ with ASP.NET Core.Enabling RabbitMQ Management Plugin – Dashboard.Installing RabbitMQ as a Service in Windows.
0 Comments
Leave a Reply. |