Problem Statement
Two services own separate databases but need denormalized views. Describe a robust data synchronization approach.
Explanation
Emit domain events from the source service and consume them to build a read model in the target. Use an event log or stream that guarantees at-least-once delivery, and make consumers idempotent to handle duplicates.
Store consumer offsets, monitor lag, and expose reconciliation jobs to fix drift. For replays, rebuild the view by re-consuming from the beginning or by bulk snapshot plus tailing new events.
Code Solution
SolutionRead Only
orders → event: OrderCreated → search-indexer builds denormalized doc
