TaskDefinition<TInput,TOutput> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A typed handle to a registered resilient task, returned by
AddResilientTask<TInput,TOutput>(IServiceCollection, String, Func<TaskContext<TInput>,
CancellationToken,Task<TOutput>>, Action<TaskRegistrationOptions>)
and AddResilientMultiTurnTask<TInput,TOutput>(IServiceCollection,
String, Func<TaskContext<TInput>,CancellationToken,Task<TOutput>>,
Boolean, Action<TaskRegistrationOptions>).
The task name and its TInput/TOutput types are
bound once at registration, so starting or running the task is strongly typed — an input or
output that does not match the registration is a compile-time error rather than a runtime failure.
The protected constructor and virtual members support substitution in consumer unit tests.
public class TaskDefinition<TInput,TOutput>
type TaskDefinition<'Input, 'Output> = class
Public Class TaskDefinition(Of TInput, TOutput)
Type Parameters
- TInput
The task input type.
- TOutput
The task output type.
- Inheritance
-
TaskDefinition<TInput,TOutput>
Constructors
| Name | Description |
|---|---|
| TaskDefinition<TInput,TOutput>() |
Initializes a new instance of the TaskDefinition<TInput,TOutput> class for mocking. |
Properties
| Name | Description |
|---|---|
| Name |
The registered task name. |
Methods
| Name | Description |
|---|---|
| DeleteAsync(String, CancellationToken) |
Ends a multi-turn chain: cancels any in-flight turn, resolves queued callers as cancelled, and removes the record. Idempotent — a no-op when the chain is absent. |
| GetActiveRunAsync(String, CancellationToken) |
Returns the in-flight run for a one-shot task keyed by |
| GetActiveRunAsync(String, String, CancellationToken) |
Returns the in-flight run for a multi-turn task keyed by |
| RunAsync(TInput, RunOptions, CancellationToken) |
Starts the task and awaits it to completion, returning the typed result. |
| StartAsync(TInput, RunOptions, CancellationToken) |
Starts the task and returns an awaitable handle once the creation round-trip succeeds. |