A command is a system operation that mutates application data, such as createOrder() or cancelOrder(). A query, by contrast, retrieves data. Commands can be invoked by a user through a UI, another application, an event, or a schedule; the operation itself is technology-neutral. section 3.1.1
A command must preserve correctness when it makes multiple changes or runs concurrently with other operations. Partial failure can leave data inconsistent, concurrent updates can conflict, and business rules such as credit limits must still hold. section 9.1.1
Creating an order
A simplified createOrder(consumerId, productId) command obtains the product price, checks and reduces the consumer’s available credit, and creates an order. These changes must be coordinated so a failure does not leave credit reduced without the intended order. section 9.1.1
When a command is local to one service, an ACID transaction is the straightforward choice. A command spanning services crosses separate database and transaction boundaries. Classic distributed transactions provide ACID guarantees but introduce complexity and runtime coupling, making them a poor fit for microservices. section 9.1 section 9.4
For a command spanning services, a saga coordinates a series of local transactions. Each step runs a service operation that validates and updates its own persistent entities. Already committed changes may require compensating transactions if a later step fails. A saga does not provide ACID isolation across its steps, so the application must address concurrent-execution anomalies itself. section 9.2 section 9.4
Figure 9.2 A saga replaces what would other be a distributed ACID transaction with a sequence of local ACID transactions in each of the participating services.
The diagram contrasts a distributed ACID transaction with the local transactions used by a saga. section 9.2






