advancedMicroservices Persistence — Database-per-Service, Outbox Pattern & CDC

What is the dual-write problem, and why can't a naive database-update-then-network-call approach avoid it?

If a database update succeeds but a subsequent, separate network call to notify another service fails (a crash, a network partition), the local data is committed but the other service never finds out — the two systems silently diverge. This is unavoidable with this approach because the database commit and the network call are two entirely separate operations with no shared transactional guarantee.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How does the outbox pattern solve the dual-write problem?← Back to all Spring Data JPA & Hibernate Mastery questions