iluwatar / iluwatar/java-design-patterns

Microservice pattern: Transactional outbox

Open
#2,671 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic: pattern info: help wanted type: feature
Dominant language
Java
Stars
94.7k
Forks
27.4k
Avg merge
3d 4h
Merged PRs (30d)
10

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Transactional Outbox Pattern reference and the Java Design Patterns contribution guidelines. Then determine how the outbox table, polling service, broker integration, idempotency, and retry behavior fit the repository. Done means all three acceptance criteria are implemented and the resulting pattern is documented consistently with the project.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka, rabbitmq
Domain
backend-api-design, databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.