In brief, Broker messaging architecture means we have a centralized broker acting like a mediator. In the brokerless messaging architecture, no broker exists and participants communicate directly with themselves.
Photo by Emre Unsplash
Example with broker message queues: RabbitMQ, IBM MQ
Example brokerless message queues: ZeroMQ, NanoMsg
In the brokerless messaging queues separate broker process does not exist.
If we use brokerless messaging queues, we probably should consider discovery, management, and availability. For example to discovery, finding the service that the message will be sent, to and what should be done if that service is down (e.g. storing messages and sending to the service when it is ready)
Broker messaging queues provide low coupling because services do not know each other.
Broker messaging queues require more network power than brokerless messaging queues.
Broker Messaging Queues
Advantages
-
Loose coupling: By using a message broker, services can communicate with each other without having direct dependencies on each other. This allows for increased flexibility and easier maintenance, as services can be added, removed, or modified without affecting other services.
-
Scalability: A message broker can handle message distribution and load balancing, allowing for horizontal scaling of services. This means that as the number of services or the workload increases, the message broker can distribute the load across multiple instances of the service, ensuring efficient resource utilization.
-
Reliability: A message broker can provide reliable message delivery by implementing features such as message persistence and guaranteed delivery. This ensures that messages are not lost in case of failures or network issues.
-
Centralized control: A message broker acts as a central hub, allowing for easier management, monitoring, and administration of messages and communication between services.
-
Message transformation and routing: Brokers often provide powerful routing capabilities, allowing messages to be transformed and directed to the appropriate destinations based on various criteria.
Disadvantages
-
Single point of failure: Since all messages pass through a central message broker if the broker fails, it can disrupt the entire messaging system.
-
Increased complexity: Setting up and configuring a message broker can be more complex compared to brokerless messaging approaches.
-
Potential performance impact: The additional overhead of routing messages through a broker can introduce some latency and potentially impact performance.
Brokerless Messaging Queues
Advantages
-
Simplicity: Brokerless messaging eliminates the need for a central message broker, reducing the complexity of the system.
-
Improved performance: Without the need to route messages through a broker, brokerless messaging can offer lower latency and higher throughput, especially for local communication between services.
Disadvantages
-
Lack of centralized control: Without a central message broker, it can be more challenging to monitor and manage message flows and ensure consistent message handling across services.
-
Scalability limitations: Brokerless messaging may not scale as well as broker-based messaging for large-scale deployments, as the responsibility for message distribution and load balancing lies with individual services.
-
No built-in guaranteed delivery: Brokerless messaging may require additional effort to implement reliable message delivery, as there is no inherent mechanism provided by a central broker.
In summary, the choice between broker-based and brokerless messaging depends on the specific requirements and constraints of the system. Consider factors such as scalability, reliability, performance, and the level of control and complexity.