dit-digital-service-manual/docs/Software Development/03-Distributed Computing Specifications/04-Race Conditions/05-Message Brokers.md

821 B

Message Brokers

When using message brokers for inter-services communications, it is worth considering situations that would result in messages that could be consumed multiple times. To resolve this, it is generally suggested to use the Competing Consumers Pattern. This will make sure that messages coming from a message broker is consumed once, by design.

RabbitMQ

Using RabbitMQ's queues is considered to be a safe option by itself as it achieves the Competing Consumers Pattern out of the box.

Kafka

When using Kafka as a message broker, make sure that consumers of the same application receive the same consumer-group-id so that only one instance of the consumers can receive the message, as opposed to all of them.