Skip to content

Microservice pattern: Transactional outbox #2671

@iluwatar

Description

@iluwatar

Description:
The Transactional Outbox design pattern ensures reliable communication between microservices by storing messages in an outbox table as part of the same local transaction that modifies application data. This pattern helps to achieve eventual consistency in distributed systems by using a separate service or process to read the outbox table and send messages to a message broker.

Main Elements of the Pattern:

  • Outbox Table: A dedicated table in the database where messages are stored as part of the same transaction that updates the application state.
  • Polling Service: A service or process that periodically reads the outbox table and sends the messages to the appropriate message broker.
  • Idempotency: Ensures that messages are processed only once, avoiding duplicate processing.
  • Error Handling and Retries: Mechanisms to handle failures in message delivery and to retry sending messages until they succeed.
  • Message Broker: A system like Kafka, RabbitMQ, etc., that acts as an intermediary to transmit messages between microservices.

References:

Acceptance Criteria:

  1. Implement an outbox table to store messages within the local transaction of the application.
  2. Develop a polling service to read messages from the outbox table and send them to a message broker.
  3. Ensure idempotent message processing and robust error handling with retries for message delivery.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions