I have a question about how to notify the client about a failure when
using a Saga (I'm aware that I could do the same with "eventual
consistency" by simply doing a query in command handler of step "2.").
In the "Meta CQRS" application we have two aggregates: "Aggregate" and
"Operation" ("Operation" is not modeled as a child entity of
"Aggregate" because it's referenced by other third party aggregates).
1) An "Operation" belongs to exactly one "Aggregate" (modeled by a
"parentAggregateId" inside the operation)
2) The name of an operation is unique inside the aggregate (modeled by
a list of operation names inside the aggregate)
CreateOperationCommand(operationId, operationName, parentAggregateId)
2. [COMMAND HANDLER]
new Operation(operationId, operationName, parentAggregateId)
// Does NOT store "parentAggregateId" yet!
=> OperationCreatedEvent(operationId, operationName,
AddOperationCommand(parentAggregateId, operationName, operationId)
4. [COMMAND HANDLER]
=> OperationAddedEvent(parentAggregateId, operationName,
=> AddOperationFailedEvent(parentAggregateId, operationName,
6. [COMMAND HANDLER]
=> AggregateAssignedEvent(operationId, parentAggregateId)
7. [COMMAND HANDLER]
How do I notify the client about this failure? (The client received an
"OK" in step "1.")