Share via


IDurableOrchestrationClient.TerminateAsync(String, String) Method

Definition

Terminates a running orchestration instance.

public System.Threading.Tasks.Task TerminateAsync (string instanceId, string reason);
abstract member TerminateAsync : string * string -> System.Threading.Tasks.Task
Public Function TerminateAsync (instanceId As String, reason As String) As Task

Parameters

instanceId
String

The ID of the orchestration instance to terminate.

reason
String

The reason for terminating the orchestration instance.

Returns

A task that completes when the terminate message is enqueued if necessary.

Exceptions

The instance id does not corespond to a valid orchestration instance.

The orchestration instance with the provided instance id is not running.

Remarks

A terminated instance will eventually transition into the Terminated state. However, this transition will not happen immediately. Rather, the terminate operation will be queued in the task hub along with other operations for that instance. You can use the GetStatusAsync(String, Boolean, Boolean, Boolean) method to know when a terminated instance has actually reached the Terminated state.

Terminating an orchestration instance has no effect on any in-flight activity function executions or sub-orchestrations that were started by the current orchestration instance.

Applies to