There are several advantages to the broker-based model:
- There is clear segregation between connected services. The only address a producer needs to know is that of the Broker.
- Producer and consumer lifetimes don't have to overlap. A Producer can send a message to a broker, die, and then much later a Consumer can come up and read the message.
There are, however, some drawbacks:
- The Broker can become a bottleneck, where all messages need to squeeze through. This can affect performance.
- There is no network I/O which is absolutely necessary.
For example, in a typical EDA architecture with a broker with four processors, we'll get a communication pattern such as this:
With a central broker, it cannot get more efficient than this. However, if the processors were allowed to talk to each other, we could have had much more efficient communication and...