Compartilhar via


TaskOrchestrationContext.CallActivityAsync Method

Definition

Overloads

CallActivityAsync(TaskName, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

CallActivityAsync(TaskName, Object, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

CallActivityAsync<TResult>(TaskName, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

CallActivityAsync<TResult>(TaskName, Object, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

CallActivityAsync(TaskName, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

public virtual System.Threading.Tasks.Task CallActivityAsync (Microsoft.DurableTask.TaskName name, Microsoft.DurableTask.TaskOptions options);
abstract member CallActivityAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task
override this.CallActivityAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task
Public Overridable Function CallActivityAsync (name As TaskName, options As TaskOptions) As Task

Parameters

name
TaskName

The name of the activity to call.

options
TaskOptions

Additional options that control the execution and processing of the activity.

Returns

A task that completes when the activity completes or fails. The result of the task is the activity's return value.

Applies to

CallActivityAsync(TaskName, Object, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

public virtual System.Threading.Tasks.Task CallActivityAsync (Microsoft.DurableTask.TaskName name, object? input = default, Microsoft.DurableTask.TaskOptions? options = default);
abstract member CallActivityAsync : Microsoft.DurableTask.TaskName * obj * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task
override this.CallActivityAsync : Microsoft.DurableTask.TaskName * obj * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task
Public Overridable Function CallActivityAsync (name As TaskName, Optional input As Object = Nothing, Optional options As TaskOptions = Nothing) As Task

Parameters

name
TaskName

The name of the activity to call.

input
Object

The serializable input to pass to the activity.

options
TaskOptions

Additional options that control the execution and processing of the activity.

Returns

A task that completes when the activity completes or fails.

Exceptions

The specified activity does not exist.

Thrown if the calling thread is anything other than the main orchestrator thread.

The activity failed with an unhandled exception. The details of the failure can be found in the FailureDetails property.

Remarks

Activities are the basic unit of work in a durable task orchestration. Unlike orchestrators, which are not allowed to do any I/O or call non-deterministic APIs, activities have no implementation restrictions.

An activity may execute in the local machine or a remote machine. The exact behavior depends on the underlying storage provider, which is responsible for distributing tasks across machines. In general, you should never make any assumptions about where an activity will run. You should also assume at-least-once execution guarantees for activities, meaning that an activity may be executed twice if, for example, there is a process failure before the activities result is saved into storage.

Both the inputs and outputs of activities are serialized and stored in durable storage. It's highly recommended to not include any sensitive data in activity inputs or outputs. It's also recommended to not use large payloads for activity inputs and outputs, which can result in expensive serialization and network utilization. For data that cannot be cheaply or safely persisted to storage, it's recommended to instead pass references (for example, a URL to a storage blob) to the data and have activities fetch the data directly as part of their implementation.

Applies to

CallActivityAsync<TResult>(TaskName, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

public virtual System.Threading.Tasks.Task<TResult> CallActivityAsync<TResult> (Microsoft.DurableTask.TaskName name, Microsoft.DurableTask.TaskOptions options);
abstract member CallActivityAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task<'Result>
override this.CallActivityAsync : Microsoft.DurableTask.TaskName * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task<'Result>
Public Overridable Function CallActivityAsync(Of TResult) (name As TaskName, options As TaskOptions) As Task(Of TResult)

Type Parameters

TResult

The type into which to deserialize the activity's output.

Parameters

name
TaskName

The name of the activity to call.

options
TaskOptions

Additional options that control the execution and processing of the activity.

Returns

Task<TResult>

A task that completes when the activity completes or fails. The result of the task is the activity's return value.

Applies to

CallActivityAsync<TResult>(TaskName, Object, TaskOptions)

Asynchronously invokes an activity by name and with the specified input value.

public abstract System.Threading.Tasks.Task<TResult> CallActivityAsync<TResult> (Microsoft.DurableTask.TaskName name, object? input = default, Microsoft.DurableTask.TaskOptions? options = default);
abstract member CallActivityAsync : Microsoft.DurableTask.TaskName * obj * Microsoft.DurableTask.TaskOptions -> System.Threading.Tasks.Task<'Result>
Public MustOverride Function CallActivityAsync(Of TResult) (name As TaskName, Optional input As Object = Nothing, Optional options As TaskOptions = Nothing) As Task(Of TResult)

Type Parameters

TResult

The type into which to deserialize the activity's output.

Parameters

name
TaskName

The name of the activity to call.

input
Object

The serializable input to pass to the activity.

options
TaskOptions

Additional options that control the execution and processing of the activity.

Returns

Task<TResult>

A task that completes when the activity completes or fails. The result of the task is the activity's return value.

Applies to