Core Concepts — Sagas, Transitions, Compensation & Effects
EricksonLopez.Processes separates deterministic state-machine logic from storage concurrency and side-effect dispatching.
Lifecycle & ProcessTransitionResult<TState>
Section titled “Lifecycle & ProcessTransitionResult<TState>”- State & identity: Domain state records implement
IProcessState, while process metadata uses strongly-typedProcessId,CorrelationId,CausationId,MessageId,ProcessType,ProcessVersion, andRevision. - Transition factories: Return
.Advance(...),.Suspend(...),.Complete(...),.Compensate(state, compensationActions),.Compensated(...), or.Fail(...). Note thatCompensate(TState state, IEnumerable<CompensationAction>? compensationActions = null)accepts only state and actions (there is noreason:parameter).
Emitted ProcessEffect & CompensationStep Stacks
Section titled “Emitted ProcessEffect & CompensationStep Stacks”ProcessEffect: Transitions emit pure intent objects (Command,Event,ScheduleTimeout,Compensation) executed outside the storage lock viaProcesses.Outbox,Processes.Mediator, orProcesses.Events.- LIFO compensation: Forward steps record
CompensationStepentries; failures triggerICompensationHandler<TState>.CompensateAsyncin reverse order up toMaxCompensations(1000default). - Roslyn Analyzers (
EricksonLopez.Processes.Analyzers):PROC001–PROC003verify[ProcessDefinition]/[SagaDefinition]contracts and ensure at least one reachable terminal transition exists.