When we are building systems with multiple components, we need a way to communicate between components. One failed attempt will be direct communication between components. In this solution, components are higly depending on each other.
A better solution will be to use a centralized middleman. All necessary components register with middleman. Middleman recieve all the requests where it find corresponding service to send it.
A broker can:
- Register, unregister services.
- Locate services.
- Recieve and send messages.
- Error handling.
There are many broker systems available. These are just few of them.
Apache ActiveMQ, Apache Kafka, RabbitMQ, Websphere ESB, JBoss ESB, Amazon MQ
- Loose coupling between components.
- Scalable and maintainable as long as the interface remain the same.
- Components are reusable.
- Introduce single point of failure.
- Degrade performance due to additional routing.