Skip to main content

CommandBook

A collection of commands to be sent to aggregates. The CommandBook is the output of sagas and process managers.

Structure

message CommandBook {
Cover cover = 1; // Target aggregate identity
repeated CommandPage pages = 2; // Commands to execute
SagaCommandOrigin saga_origin = 3; // For compensation tracking
}

CommandPage

Each page contains:

  • Command payload: The actual command (Any type)
  • Sequence: Expected aggregate sequence (for concurrency)
  • Merge strategy: How to handle conflicts

Merge Strategies

StrategyBehavior
MERGE_STRICTReject on sequence mismatch
MERGE_COMMUTATIVEAllow if mutations don't overlap
MERGE_AGGREGATE_HANDLESAggregate decides
MERGE_MANUALRoute to DLQ for review

Saga Origin

Tracks the source of saga-issued commands for compensation:

  • Saga name
  • Triggering aggregate (domain, root)
  • Triggering event sequence

If the command is rejected, a RejectionNotification is sent back to the saga.