Share via


DurableTaskClient.ScheduleNewOrchestrationInstanceAsync Method

Definition

Overloads

ScheduleNewOrchestrationInstanceAsync(TaskName, CancellationToken)

Schedules a new orchestration instance for execution.

ScheduleNewOrchestrationInstanceAsync(TaskName, StartOrchestrationOptions, CancellationToken)

Schedules a new orchestration instance for execution.

ScheduleNewOrchestrationInstanceAsync(TaskName, Object, CancellationToken)

Schedules a new orchestration instance for execution.

ScheduleNewOrchestrationInstanceAsync(TaskName, Object, StartOrchestrationOptions, CancellationToken)

Schedules a new orchestration instance for execution.

ScheduleNewOrchestrationInstanceAsync(TaskName, CancellationToken)

Schedules a new orchestration instance for execution.

public virtual System.Threading.Tasks.Task<string> ScheduleNewOrchestrationInstanceAsync (Microsoft.DurableTask.TaskName orchestratorName, System.Threading.CancellationToken cancellation);
abstract member ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
override this.ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Overridable Function ScheduleNewOrchestrationInstanceAsync (orchestratorName As TaskName, cancellation As CancellationToken) As Task(Of String)

Parameters

orchestratorName
TaskName

The name of the orchestrator to schedule.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the orchestration once enqueued.

Returns

A task that completes when the orchestration instance is successfully scheduled. The value of this task is the instance ID of the scheduled orchestration instance. If a non-null instance ID was provided via options, the same value will be returned by the completed task.

Applies to

ScheduleNewOrchestrationInstanceAsync(TaskName, StartOrchestrationOptions, CancellationToken)

Schedules a new orchestration instance for execution.

public virtual System.Threading.Tasks.Task<string> ScheduleNewOrchestrationInstanceAsync (Microsoft.DurableTask.TaskName orchestratorName, Microsoft.DurableTask.StartOrchestrationOptions options, System.Threading.CancellationToken cancellation = default);
abstract member ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.StartOrchestrationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
override this.ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.StartOrchestrationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Overridable Function ScheduleNewOrchestrationInstanceAsync (orchestratorName As TaskName, options As StartOrchestrationOptions, Optional cancellation As CancellationToken = Nothing) As Task(Of String)

Parameters

orchestratorName
TaskName

The name of the orchestrator to schedule.

options
StartOrchestrationOptions

The options to start the new orchestration with.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the orchestration once enqueued.

Returns

A task that completes when the orchestration instance is successfully scheduled. The value of this task is the instance ID of the scheduled orchestration instance. If a non-null instance ID was provided via options, the same value will be returned by the completed task.

Applies to

ScheduleNewOrchestrationInstanceAsync(TaskName, Object, CancellationToken)

Schedules a new orchestration instance for execution.

public virtual System.Threading.Tasks.Task<string> ScheduleNewOrchestrationInstanceAsync (Microsoft.DurableTask.TaskName orchestratorName, object? input, System.Threading.CancellationToken cancellation);
abstract member ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
override this.ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Overridable Function ScheduleNewOrchestrationInstanceAsync (orchestratorName As TaskName, input As Object, cancellation As CancellationToken) As Task(Of String)

Parameters

orchestratorName
TaskName

The name of the orchestrator to schedule.

input
Object

The optional input to pass to the scheduled orchestration instance. This must be a serializable value.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the orchestration once enqueued.

Returns

A task that completes when the orchestration instance is successfully scheduled. The value of this task is the instance ID of the scheduled orchestration instance. If a non-null instance ID was provided via options, the same value will be returned by the completed task.

Applies to

ScheduleNewOrchestrationInstanceAsync(TaskName, Object, StartOrchestrationOptions, CancellationToken)

Schedules a new orchestration instance for execution.

public abstract System.Threading.Tasks.Task<string> ScheduleNewOrchestrationInstanceAsync (Microsoft.DurableTask.TaskName orchestratorName, object? input = default, Microsoft.DurableTask.StartOrchestrationOptions? options = default, System.Threading.CancellationToken cancellation = default);
abstract member ScheduleNewOrchestrationInstanceAsync : Microsoft.DurableTask.TaskName * obj * Microsoft.DurableTask.StartOrchestrationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public MustOverride Function ScheduleNewOrchestrationInstanceAsync (orchestratorName As TaskName, Optional input As Object = Nothing, Optional options As StartOrchestrationOptions = Nothing, Optional cancellation As CancellationToken = Nothing) As Task(Of String)

Parameters

orchestratorName
TaskName

The name of the orchestrator to schedule.

input
Object

The optional input to pass to the scheduled orchestration instance. This must be a serializable value.

options
StartOrchestrationOptions

The options to start the new orchestration with.

cancellation
CancellationToken

The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the orchestration once enqueued.

Returns

A task that completes when the orchestration instance is successfully scheduled. The value of this task is the instance ID of the scheduled orchestration instance. If a non-null instance ID was provided via options, the same value will be returned by the completed task.

Implements

Exceptions

Thrown if orchestratorName is empty.

Remarks

All orchestrations must have a unique instance ID. You can provide an instance ID using the options parameter or you can omit this and a random instance ID will be generated for you automatically. If an orchestration with the specified instance ID already exists and is in a non-terminal state (Pending, Running, etc.), then this operation may fail silently. However, if an orchestration instance with this ID already exists in a terminal state (Completed, Terminated, Failed, etc.) then the instance may be recreated automatically, depending on the configuration of the backend instance store.

Orchestration instances started with this method will be created in the Pending state and will transition to the Running after successfully awaiting its first task. The exact time it takes before a scheduled orchestration starts running depends on several factors, including the configuration and health of the backend task hub, and whether a start time was provided via options.

The task associated with this method completes after the orchestration instance was successfully scheduled. You can use the GetInstancesAsync(String, Boolean, CancellationToken) to query the status of the scheduled instance, the WaitForInstanceStartAsync(String, Boolean, CancellationToken) method to wait for the instance to transition out of the Pending status, or the WaitForInstanceCompletionAsync(String, Boolean, CancellationToken) method to wait for the instance to reach a terminal state (Completed, Terminated, Failed, etc.).

Applies to