Share via


DurableTaskClient.RaiseEventAsync Method

Definition

Overloads

RaiseEventAsync(String, String, CancellationToken)

Sends an event notification message to a waiting orchestration instance.

RaiseEventAsync(String, String, Object, CancellationToken)

Sends an event notification message to a waiting orchestration instance.

RaiseEventAsync(String, String, CancellationToken)

Sends an event notification message to a waiting orchestration instance.

public virtual System.Threading.Tasks.Task RaiseEventAsync (string instanceId, string eventName, System.Threading.CancellationToken cancellation);
abstract member RaiseEventAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RaiseEventAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function RaiseEventAsync (instanceId As String, eventName As String, cancellation As CancellationToken) As Task

Parameters

instanceId
String

The ID of the orchestration instance that will handle the event.

eventName
String

The name of the event. Event names are case-insensitive.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the event to the backend. Does not abort sending the event once enqueued.

Returns

A task that completes when the event notification message has been enqueued.

Applies to

RaiseEventAsync(String, String, Object, CancellationToken)

Sends an event notification message to a waiting orchestration instance.

public abstract System.Threading.Tasks.Task RaiseEventAsync (string instanceId, string eventName, object? eventPayload = default, System.Threading.CancellationToken cancellation = default);
abstract member RaiseEventAsync : string * string * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public MustOverride Function RaiseEventAsync (instanceId As String, eventName As String, Optional eventPayload As Object = Nothing, Optional cancellation As CancellationToken = Nothing) As Task

Parameters

instanceId
String

The ID of the orchestration instance that will handle the event.

eventName
String

The name of the event. Event names are case-insensitive.

eventPayload
Object

The serializable data payload to include with the event.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the event to the backend. Does not abort sending the event once enqueued.

Returns

A task that completes when the event notification message has been enqueued.

Exceptions

Thrown if instanceId or eventName is null or empty.

Remarks

In order to handle the event, the target orchestration instance must be waiting for an event named eventName using the WaitForExternalEvent<T>(String, CancellationToken) API. If the target orchestration instance is not yet waiting for an event named eventName, then the event will be saved in the orchestration instance state and dispatched immediately when the orchestrator calls WaitForExternalEvent<T>(String, CancellationToken). This event saving occurs even if the orchestrator has canceled its wait operation before the event was received.

Orchestrators can wait for the same event name multiple times, so sending multiple events with the same name is allowed. Each external event received by an orchestrator will complete just one task returned by the WaitForExternalEvent<T>(String, CancellationToken) method.

Raised events for a completed or non-existent orchestration instance will be silently discarded.

Applies to