iluwatar / iluwatar/java-design-patterns
Microservice pattern: Transactional outbox
Nobody has claimed this yet.
- 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:
- Transactional Outbox Pattern - Microservices Patterns
- Java Design Patterns Project Contribution Guidelines
Acceptance Criteria:
- Implement an outbox table to store messages within the local transaction of the application.
- Develop a polling service to read messages from the outbox table and send them to a message broker.
- Ensure idempotent message processing and robust error handling with retries for message delivery.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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