Back to Catalog
Microservices
Data Management
Command-Side Replica
Keep a local read-only copy of another service's data — query it without cross-service calls.
Intent & Description
Real-world Use Case
Order Service keeps a local MenuReplica DB. When Restaurant Service publishes MenuUpdated events, Order Service syncs it. createOrder() validates against local replica — fast, decoupled, no synchronous call.
Source
📌 TL;DR
Instead of calling another service in your command handler, subscribe to its events and keep a local copy. Trade consistency for autonomy.
Advantages
- Command handlers are fully decoupled from provider service at runtime
- No synchronous inter-service call = lower latency, better availability
- Commands can use DB-level queries on replica data (joins, filters)
- Provider service can go down without blocking commands
Disadvantages
- Replica is eventually consistent — commands may act on stale data
- Event schema changes require replica migration
- Adds storage overhead per consuming service
- Data duplication across the system increases