Skip to content

Add Outbox Pattern for Event Publishing #3531

Description

@umairaalvi4843-hub

hey,
I've been looking through the patterns catalog and noticed you don't have an implementation for the Outbox pattern yet. I think it would be a really valuable addition because microservices and event driven architectures are very common.

the problem:
Your service needs to save something to its database and publish an event about it. But doing these two things separately means things can break. The database update might succeed, but the message broker might be down, creating zombie messages and all also causing inconsistencies.
The Outbox pattern is the fix for this. Instead of trying to do both things at once, you save the event alongside the business data in the same database transaction. Then a background process reads those events from the database and reliably pushes them out.

My plan for the implementation:
I was thinking of building a clean Spring Boot + Kafka example that shows this in action, following the project's guidelines.

What I'd include:
A new Maven module something like transactionaloutbox
The core logic: a service that saves both the business entity and the outbox record in one transaction, plus a scheduled publisher that processes pending events
A simple demo app that shows the whole flow, from creating an order to the event being consumed
Documentation: a proper README following the project's template and a UML diagram
Tests: unit tests for the core logic, integration tests with a real database and Kafka
Docker Compose
Why I think this is valuable

It's a real-world pattern that developers actually need
It fills a gap in the current catalog
It's a great learning resource for anyone building distributed systems
It touches on modern Java ecosystem tools like Spring, JPA, and Kafka

I've been referencing a few existing implementations:

I've been looking at the outbox-example repo (https://github.com/microservices-patterns/outbox-example) and springboot-kafka-transactionaloutbox (https://github.com/MertYilmazda/springboot-kafka-transactional-outbox) to make sure I get the details right.

I'd love to get some feedback on this idea. Does this sound like a good fit for the project? If so, I'm happy to start working on it and follow the contribution guide to get a clean PR ready.

Thanks for your time 🙌

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions