共用方式為


IDurableOrchestrationContext.CreateTimer Method

Definition

Overloads

CreateTimer(DateTime, CancellationToken)

Creates a durable timer that expires at a specified time.

CreateTimer<T>(DateTime, T, CancellationToken)

Creates a durable timer that expires at a specified time.

CreateTimer(DateTime, CancellationToken)

Source:
IDurableOrchestrationContext.cs

Creates a durable timer that expires at a specified time.

public System.Threading.Tasks.Task CreateTimer (DateTime fireAt, System.Threading.CancellationToken cancelToken);
abstract member CreateTimer : DateTime * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function CreateTimer (fireAt As DateTime, cancelToken As CancellationToken) As Task

Parameters

fireAt
DateTime

The time at which the timer should expire.

cancelToken
CancellationToken

The CancellationToken to use for cancelling the timer.

Returns

A durable task that completes when the durable timer expires.

Remarks

All durable timers created using this method must either expire or be cancelled using the cancelToken before the orchestrator function completes. Otherwise the underlying framework will keep the instance in the "Running" state even after the orchestrator function has completed.

Applies to

CreateTimer<T>(DateTime, T, CancellationToken)

Source:
IDurableOrchestrationContext.cs

Creates a durable timer that expires at a specified time.

public System.Threading.Tasks.Task<T> CreateTimer<T> (DateTime fireAt, T state, System.Threading.CancellationToken cancelToken);
abstract member CreateTimer : DateTime * 'T * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function CreateTimer(Of T) (fireAt As DateTime, state As T, cancelToken As CancellationToken) As Task(Of T)

Type Parameters

T

The type of state.

Parameters

fireAt
DateTime

The time at which the timer should expire.

state
T

Any state to be preserved by the timer.

cancelToken
CancellationToken

The CancellationToken to use for cancelling the timer.

Returns

Task<T>

A durable task that completes when the durable timer expires.

Remarks

All durable timers created using this method must either expire or be cancelled using the cancelToken before the orchestrator function completes. Otherwise the underlying framework will keep the instance in the "Running" state even after the orchestrator function has completed.

Applies to