ข้ามไปยังเนื้อหา

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 IBehaviorContext

When the behavior topology uses the direct pattern, is not supported and will throw . Use the behavior's return value to communicate results in the direct pattern.

Gets the stable identifier of the behavior being executed.

string BehaviorId { get; }

string

Gets the correlation identifier for the current execution, or null if not provided.

string? CorrelationId { get; }

string?

Gets the event store for the current behavior context, or null if event sourcing is not configured for this behavior.

IEventStore? EventStore { get; }

IEventStore?

Gets ambient metadata associated with the current execution (e.g. correlation id, tenant id).

IReadOnlyDictionary<string, string> Metadata { get; }

IReadOnlyDictionary<string, string>

Sends a reply message back to the caller through the active transport.

Task ReplyAsync(object reply, CancellationToken cancellationToken = default)

reply object

The reply object to send.

cancellationToken CancellationToken

A token that cancels the reply.

Task

A task that completes when the reply has been dispatched.

NotSupportedException

Thrown when the active behavior topology uses the direct pattern, which does not support fire-and-forget reply semantics.