Posted By : Pankaj Garg | 31-Oct-2022
What is a message broker?
Message broker is software that helps to communicate between two or more applications and services with the help of messages. The message is initially defined by the service that sends them.
Working of a message broker.
There are three basic concepts involved in the working of this message broker.
1. Producer:- A producer is one who sends the message also known as the message publisher or message sender.
2. Consumer:- A consumer is the one who receives the message published or sent by the producer.
3. Queue:- Queue is also known as the Topic and it is the folder in the file system which stores the message in the form of a queue in the folder.
Types of message broker
In the point-to-point message broker, there is a one-to-one relationship between a sender and a receiver. The sender of the message does not know anything about the receiver and vice-versa.
In the publish-subscriber message broker, there is one publisher and multiple receivers also known as subscribers. The message is sent by the publisher or producer and all the services that have subscribed to receive the message, initially, the message is saved to the queue and later on send to the subscribers.
Advantages of Publish-Subscribe
1. The publish-subscribe method provides communication between the services that may not be running at the same time because it saves the message in a queue.
2. It also improves the performance of the system by providing asynchronous processing.
3. The publish-subscribe also increases the reliability of the message by guaranteeing a transmission of a message.
Disadvantages of Publish-Subscribe
1. It increases the complexity
2. Harder to Debug
3. Steep learning curve at first
1. When two services are not running at the same time.
2. Where trust and reliability of the message sent are required.