Skip to content

Conversation

tanya-johari
Copy link

What does this PR do?

This pull request implements the Transactional Outbox design pattern. It demonstrates how to ensure reliable, at-least-once message delivery from a service by atomically saving business data and its corresponding event in the same database transaction. This PR includes a fully documented code implementation, comprehensive unit tests covering success and failure scenarios, a detailed README and a PlantUML class diagram.

Key features

Customer: The main business entity model that is being created and persisted.

OutboxEvent: The entity representing the message to be sent, which is stored transactionally in the outbox table.

CustomerService: The service that handles the core business logic, responsible for creating the Customer and the OutboxEvent in a single, atomic transaction.

OutboxRepository: The data access layer for reading from and writing OutboxEvent entities to the database.

EventPoller: A background process that periodically scans the outbox table for unprocessed events and publishes them to the message broker.

MessageBroker: A mock implementation that simulates sending the event to an external messaging system.

This pull request is submitted as part of my participation in Hacktoberfest 2025

Closes #2671

Copy link

github-actions bot commented Oct 5, 2025

Analyzing changes in this PR...

This might take a few minutes, please wait

📥 Commits

Analyzing changes from base (ede37bd) to latest commit (d840eea):

Resolves #2671

Resolves #2671

Resolves #2671

Resolves #2671

  • 3e1e516: feat: Implement Transactional Outbox pattern

Resolves #2671

📁 Files being considered (20)

➕ microservices-transactional-outbox/README.md (1 hunk)
➕ microservices-transactional-outbox/etc/microservices-transactional-outbox-flowchart.png (0 hunks)
➕ microservices-transactional-outbox/etc/microservices-transactional-outbox.puml (1 hunk)
➕ microservices-transactional-outbox/pom.xml (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/App.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/Customer.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/CustomerService.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/EventPoller.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/MessageBroker.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/OutboxEvent.java (1 hunk)
➕ microservices-transactional-outbox/src/main/java/com/iluwatar/transactionaloutbox/OutboxRepository.java (1 hunk)
➕ microservices-transactional-outbox/src/main/resources/META-INF/persistence.xml (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/AppTest.java (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/CustomerServiceTests.java (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/EventPollerTests.java (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/MessageBrokerTests.java (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/OutboxEventTests.java (1 hunk)
➕ microservices-transactional-outbox/src/test/java/com/iluwatar/transactionaloutbox/OutboxRepositoryTests.java (1 hunk)
➕ microservices-transactional-outbox/src/test/resources/META-INF/persistence.xml (1 hunk)
🔄 pom.xml (1 hunk)


autogenerated by presubmit.ai

Copy link

sonarqubecloud bot commented Oct 5, 2025

@tanya-johari
Copy link
Author

Hello @iluwatar the implementation is complete and it's ready for review whenever you have a moment. Please let me know if there are any changes or additional information you need from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Microservice pattern: Transactional outbox
1 participant