What is Message Broker?
Before I start explaining about Message Broker will explain about the term Messaging Middleware.
A Messaging Middleware is an intermediate application which enables communication & data exchange between distributed applications. It can also be called software glue. So, what does it try to solve?
Suppose if there are 5 applications & if each applications wants to communicate among them, it requires ten connections. Similarly, if there are 10 apps then to communicate among them it requires 45 connections which is too many connections to maintain even though in real world scenario, we might not need 45 connections, still it's a complex thing to maintain. Below is the diagrammatic representation of what I explained.
Formula to calculate number of connections is
(n * (n-1) ) /2
Where n is the number of nodes (here its application)
5 (5 - 1) / 2 = 10
10 (10–1) / 2 = 45
20 (20–1) / 2 = 190
Here is the solution instead of sending messages to every apps individually send messages to the Middleware & in turn it takes cares of the complexity involved.
- Each application doesn’t have to know the location of each application.
- Easier to scale when number of applications increases.
- It helps streamline processes and improves efficiency in terms of organization.
- An extra component is required for transferring messages.
- Not suitable real time operations impact performance.
There are various methods to communicate & one of the methods of communication used by Messaging Middleware is a server-based model that uses a Message Broker. Here is the general representation of Message Broker
Various Messaging Models
- Point to Point
- Publisher Subscriber
Point to Point
This is a very straight forward and simplest communication model by which Producer pushes the message to the Queue and from the Queue it is either pushed/pulled to/by the Consumer. In this approach multiple Producers can push messages to the Queue.
In this model the Publisher sends the message to a Topic and the message is pushed to the Subscribers. In this one more Publisher can publish the message to the same topic.
Here are some of the popular Message Brokers
Please let me know your valuable feedback/comments.
by the author.