Interface IBehaviorContext
Namespace: Cephalon.Abstractions.Behaviors
Assembly: Cephalon.Abstractions.dll
Provides ambient context to a behavior during its execution. The context exposes reply semantics, metadata, and cancellation.
public interface IBehaviorContextRemarks
Section titled “Remarks”
When the behavior topology uses the direct pattern,
Properties
Section titled “Properties”BehaviorId
Section titled “ BehaviorId”Gets the stable identifier of the behavior being executed.
string BehaviorId { get; }Property Value
Section titled “Property Value”CorrelationId
Section titled “ CorrelationId”Gets the correlation identifier for the current execution, or null if not provided.
string? CorrelationId { get; }Property Value
Section titled “Property Value”EventStore
Section titled “ EventStore”Gets the event store for the current behavior context, or null if event sourcing is not configured for this behavior.
IEventStore? EventStore { get; }Property Value
Section titled “Property Value”Metadata
Section titled “ Metadata”Gets ambient metadata associated with the current execution (e.g. correlation id, tenant id).
IReadOnlyDictionary<string, string> Metadata { get; }Property Value
Section titled “Property Value”IReadOnlyDictionary<string, string>
Methods
Section titled “Methods”ReplyAsync(object, CancellationToken)
Section titled “ ReplyAsync(object, CancellationToken)”Sends a reply message back to the caller through the active transport.
Task ReplyAsync(object reply, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”reply object
The reply object to send.
cancellationToken CancellationToken
A token that cancels the reply.
Returns
Section titled “Returns”A task that completes when the reply has been dispatched.
Exceptions
Section titled “Exceptions”Thrown when the active behavior topology uses the direct pattern,
which does not support fire-and-forget reply semantics.