Skip to content

Class EventDrivenExecutionStrategy

Namespace: Cephalon.Behaviors.Patterns.Strategies
Assembly: Cephalon.Behaviors.Patterns.dll

Executes behaviors that follow the event-driven (fire-and-forget) pattern. Returns HTTP 202 Accepted immediately while the behavior runs in the background.

public sealed class EventDrivenExecutionStrategy : IBehaviorExecutionStrategy

objectEventDrivenExecutionStrategy

IBehaviorExecutionStrategy

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

EventDrivenExecutionStrategy(ILogger<EventDrivenExecutionStrategy>)

Section titled “ EventDrivenExecutionStrategy(ILogger<EventDrivenExecutionStrategy>)”

Initializes a new instance of .

public EventDrivenExecutionStrategy(ILogger<EventDrivenExecutionStrategy> logger)

logger ILogger<EventDrivenExecutionStrategy>

The logger used to report background faults.

Gets the pattern identifier handled by this strategy.

public string Pattern { get; }

string

ExecuteAsync(BehaviorExecutionContext, CancellationToken)

Section titled “ ExecuteAsync(BehaviorExecutionContext, CancellationToken)”

Dispatches the behavior invocation on a background thread and immediately returns 202 Accepted. Any exception thrown synchronously before the background task is launched propagates to the caller. Background faults are caught and logged; they do not surface to the caller.

public Task<BehaviorExecutionResult> ExecuteAsync(BehaviorExecutionContext context, CancellationToken ct = default)

context BehaviorExecutionContext

The execution context for this invocation.

ct CancellationToken

A token that cancels the execution.

Task<BehaviorExecutionResult>

A fire-and-forget result with HTTP 202.