Choose a message broker: understand work queues and event distribution
A message broker receives and delivers messages between producers and consumers, reducing temporal coupling between systems. The label “broker” does not make a work queue, pub/sub distribution, and a retained event stream behave the same way. Use a queue model when consumer instances share work and each task is completed once; use pub/sub when independent subscribers need their own copy of an event; consider a retained log when consumers must reread history or process a stream.
A message broker receives and delivers messages between producers and consumers, reducing temporal coupling between systems. The label “broker” does not make a work queue, pub/sub distribution, and a retained event stream behave the same way. Use a queue model when consumer instances share work and each task is completed once; use pub/sub when independent subscribers need their own copy of an event; consider a retained log when consumers must reread history or process a stream.
What does a broker do?
Producers send messages to the broker, which routes them to queues or subscriptions according to rules. Consumers receive and process messages, then acknowledge completion according to the broker’s model. This intermediary lets producers and consumers run at different times and provides delivery functions such as routing, buffering, and redelivery. It does not guarantee business correctness. Applications still need to handle duplicate effects, business ordering, schema compatibility, and external side effects.
Choose a messaging model
| Need | Suitable model | Check in the design |
|---|---|---|
| Consumer instances share tasks and completed messages are removed | Work queue (point-to-point, competing consumers) | Redelivery, duplicates, acknowledgement timing, load leveling, failure isolation |
| Independent subscribers each process a copy of an event | Pub/sub topic and subscriptions | Per-subscription filters, retention, backlog, permissions, and processing state |
| Events are retained while consumers manage positions and replay or process streams | Partitioned event log/stream | Partition key, per-partition order, offsets/checkpoints, retention cost, replay range |
Names and features vary by product. Azure Service Bus queues distribute each message to one consumer, while topics and subscriptions make copies for multiple subscribers. In RabbitMQ’s AMQP 0-9-1 model, producers publish to an exchange, which routes to one or more queues using bindings and routing keys. Kafka treats topic events as retained partition logs that consumers can reread by managing offsets. These descriptions are product-specific; do not assume equivalent guarantees.
A decision sequence
**Distinguish a command from a fact.** “Perform this task” often fits a queue completed by one worker. If multiple services each need to know “this happened,” pub/sub copies may fit. This is a common design heuristic, not a protocol rule.
**Check replay needs.** If processing removes a message, replay may depend on backups or separate archives. If consumers must reread history after an outage or when a new subscriber is added, check retained-log or per-subscription retention behavior.
**Define the scope of ordering.** Requiring total system-wide order can reduce parallelism or raise latency. Define which business key needs order, then verify whether the selected broker provides order globally, by session, group, or partition. For example, Kafka preserves record order within a topic partition and can map the same key to the same partition; that is not one total order across the whole topic.
**Quantify failures and volume.** Set acceptable latency, maximum backlog, throughput, message size, retention, tolerated loss during an outage, and recovery objectives. Broker durability settings do not replace application backups/recovery or consumer idempotency.
**Account for operations.** A managed service still needs permissions, schemas, alerts, replay, retention, cost management, network connectivity, and incident response. A self-managed broker also requires upgrades, capacity, replication, security patches, and recovery plans. A broker can add needless complexity to a simple synchronous request.
Boundaries and failure handling
A broker acknowledgement generally confirms a delivery or storage step, not that the whole business operation happened exactly once. If a consumer stops after processing but before acknowledging, the message can be redelivered. Store business effects and deduplication markers atomically or make the consumer idempotent. Effects in different external systems cannot share one database transaction; consider an external idempotency key, outbox/inbox, and reconciliation procedure.
Expiry, retry, and dead-letter policies also differ by broker. Message expiry does not mean the same thing as retaining old events, and replay does not automatically restore original order. Review the chosen product’s delivery, retention, partition/group, acknowledgement, and dead-letter documentation.
A small design review
Before adoption, sketch one message path: when the producer considers the send successful, where the message is stored, which consumer receives it, how completion is acknowledged, where failures go, whether replay is needed, and how duplicates and order are handled. If those questions are unanswered, clarify the delivery contract before choosing a broker. No real broker configuration or comparative test was run for this article.
Sources
[Azure Service Bus: Queues, topics, and subscriptions](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions)
[RabbitMQ: AMQP 0-9-1 model explained](https://www.rabbitmq.com/tutorials/amqp-concepts)
[Apache Kafka: Introduction and main concepts](https://kafka.apache.org/documentation.html)