Message Brokers¶
Message brokers are infrastructure components that route, buffer, and deliver messages between services. Instead of services calling each other directly, they send messages to a broker, which then forwards them to the appropriate consumers. This makes your system more loosely coupled, more resilient to spikes in load, and better suited for asynchronous processing.
For this product, you describe how and why you use a message broker in your project, which queues or topics you define, and how producers and consumers are implemented.
Message Brokers in Back-end Systems¶
Typical capabilities of message brokers include:
- Queues for point-to-point messaging
- Topics or pub/sub for broadcasting events
- Routing based on headers or message attributes
- Persistence and durability guarantees
- Dead-letter queues for failed messages
Examples of message brokers are RabbitMQ, Kafka, AWS SQS/SNS, Azure Service Bus, and many others.
Quality indicators¶
When assessing this product, the following quality indicators will be considered:
- The message brokers document is self-contained, with an introduction/context and then a description of the chosen design.
- It explains why a message broker is used in the project (for example decoupling, buffering, background work).
- It describes the queues/topics and their purposes.
- It describes how producers and consumers are implemented in the code.
- It explains how reliability is handled (acknowledgements, retries, dead-letter queues, idempotency).
- It includes examples of code or configuration that interact with the broker, with references to the code in GitLab.
- It describes how you monitor and troubleshoot message flows (for example metrics, dashboards, logs).
- It includes a list of sources used to design and implement messaging with a broker.
Template¶
To document message brokers in your own project, you can use the following template:
# Message Brokers
In this section, describe in a few sentences why you introduced a message broker and what problem it solves in your project. This is the main text of your document.
## Context & Use Cases
Here you describe:
- Which parts of your system produce messages
- Which parts consume them
- What kinds of work are handled asynchronously (for example sending emails, processing orders)
## Queues / Topics Design
Here you describe the design of your queues or topics:
- Names and purposes
- Which message types they carry
- Any routing rules or conventions
## Implementation
Here you describe how producers and consumers are implemented:
- Which libraries or SDKs you use
- How you publish and consume messages in code
- How you configure connection details and credentials (for example environment variables)
Add code and configuration examples and references to the code in GitLab.
## Reliability & Monitoring
Here you describe:
- How acknowledgements, retries, and dead-letter queues are configured
- How you avoid duplicate processing (idempotency)
- How you monitor queues/topics (metrics, dashboards, alerts)
## Sources
List here the sources you used to design and implement message brokering (documentation, articles, videos, books, etc.).
Also include sources that helped you write the code.