How do you keep duplicated data in sync across services when each service owns its own copy?
Last updated
The owning service is the single source of truth. It publishes domain events (e.g.
CustomerUpdated) that consumers apply to their local read-only copies.Publish reliably with the Transactional Outbox. Make consumers idempotent (dedupe by event ID) and use versions or timestamps so out-of-order events don't overwrite newer data.
Repair drift with replay or periodic reconciliation. Duplicate only the fields you need and tolerate brief staleness.
- https://martinfowler.com/articles/201701-event-driven.html
- https://learn.microsoft.com/en-us/azure/architecture/patterns/materialized-view
- https://dev.to/dinesh_dunukedeniya_539a3/fixing-microservice-dependencies-with-self-contained-events-aka-ecst-2l39
- https://dev.to/noting59/event-carried-state-transfer-for-tax-calculation-in-fintech-real-time-architecture-with-kafka-go-k24
- https://learn.microsoft.com/en-us/azure/architecture/patterns/cqrs
- https://medium.com/swlh/event-notification-vs-event-carried-state-transfer-2e4fdf8f6662
- https://learn.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/subscribe-events