Message broker¶
Allows system to be more loosely coupled and failure resilient.
Key considerations when selecting a message broker:
- Does the broker adhere to established standards like AMQP and STOMP, or does it have a proprietary system?
- Durability — Will the broker deliver messages sent during a consumer's downtime once it reconnects?
- Concurrent Consumers — Can the broker handle multiple consumers competing for messages?
| Broker | Point-to-point | Publish Subscribe |
|---|---|---|
| JMS | Queue | Topic |
| Kafka | Topic | Topic |
| AMPQ-based such as RobbitMQ | Exchange + Queue | Fanout exchange and a queue per consumer |
| AWS Kinesis | Stream | Stream |
| AWS SQS | Queue | - |
| Kafka don’t support distributed transactions. |
Pros and cons - ✅ Loose coupling - ✅ Failure resilient, allows to handle burst traffic - ⛔ Additional operational complexity. The messaging system is yet another system component that must be installed, configured, and operated. - ⛔ Message broker must be HA and scalable.
References¶
- Microservices patterns by Chris Richardson, chapter 3