A command-side replica maintains a local, read-only copy of data from another service so a command can query it efficiently. It is a service collaboration pattern for distributed commands: operations that span multiple services. section 7.6.2
Distributed operations cross process and transaction boundaries, making them more complicated than local operations. With eventual consistency, they require careful design: database locking and rollback cannot coordinate the whole operation, and concurrency must be handled at the application level. section 7.5.1
Choose the collaboration pattern for the operation’s job:
- Use a command-side replica when a command needs to query data owned by another service. Use a saga to implement a distributed command as a series of local transactions. section 7.6.2
- For distributed queries, API composition queries services and aggregates their results; CQRS maintains a read-only, efficiently queryable replica combining data from multiple services. section 7.6.2
