Class SagaExecutionStrategy
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
Namespace: Cephalon.Behaviors.Patterns.Strategies
Assembly: Cephalon.Behaviors.Patterns.dll
Executes behaviors that follow the saga-step pattern. Loads saga state before invocation and persists it after a successful execution. On exception, state is NOT saved so that explicit compensation logic can be applied.
public sealed class SagaExecutionStrategy : IBehaviorExecutionStrategyInheritance
Section titled “Inheritance”object ← SagaExecutionStrategy
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Section titled “Constructors”SagaExecutionStrategy(ISagaStateStore, ILogger<SagaExecutionStrategy>)
Section titled “ SagaExecutionStrategy(ISagaStateStore, ILogger<SagaExecutionStrategy>)”Initializes a new instance of
public SagaExecutionStrategy(ISagaStateStore store, ILogger<SagaExecutionStrategy> logger)Parameters
Section titled “Parameters”store ISagaStateStore
The saga state store used to load and persist saga state.
logger ILogger<SagaExecutionStrategy>
The logger used to report warnings and errors.
Properties
Section titled “Properties”Pattern
Section titled “ Pattern”Gets the pattern identifier handled by this strategy.
public string Pattern { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”ExecuteAsync(BehaviorExecutionContext, CancellationToken)
Section titled “ ExecuteAsync(BehaviorExecutionContext, CancellationToken)”Loads saga state, invokes the behavior slot, and saves the updated state on success.
If the behavior throws, state is not persisted so compensation can be applied externally.
The saga identifier is read from
public Task<BehaviorExecutionResult> ExecuteAsync(BehaviorExecutionContext context, CancellationToken ct = default)Parameters
Section titled “Parameters”context BehaviorExecutionContext
The execution context for this invocation.
A token that cancels the execution.
Returns
Section titled “Returns”A result with HTTP 200 and the behavior output.