Skip to content

DurableTaskReference<TResult> Methods

A reference to an existing durable task of a grain, which DurableTaskGrainExtensions returns.

AbortAsync(string, CancellationToken)

View source
public ValueTask AbortAsync(string reason, CancellationToken cancellationToken = default(CancellationToken))
Administratively aborts the task, which terminalizes it and its execution tree as failed with DurableTaskAbortedException without running further task code.

Parameters

reasonstring
The reason for the abort, recorded as the exception message.
cancellationTokenCancellationToken
A token which abandons waiting for the abort to commit.

CancelAsync(CancellationToken)

View source
public ValueTask CancelAsync(CancellationToken cancellationToken = default(CancellationToken))
Requests durable cancellation of the task.

Parameters

cancellationTokenCancellationToken
A token which abandons waiting for the request to commit.

CancelAsync(string?, CancellationToken)

View source
public ValueTask CancelAsync(string? reason, CancellationToken cancellationToken = default(CancellationToken))
Requests durable cancellation of the task carrying reason.

Parameters

reasonstring?
The reason which the task's DurableTaskContext reports, or null for none. The first request determines the reason.
cancellationTokenCancellationToken
A token which abandons waiting for the request to commit.

GetResponseAsync(CancellationToken)

View source
public Task<DurableTaskResponse> GetResponseAsync(CancellationToken cancellationToken = default(CancellationToken))
Waits for the task's terminal response.

Parameters

cancellationTokenCancellationToken
A token which abandons the wait. It doesn't cancel the task.

Exceptions

Orleans.Durable.Tasks.DurableTaskNotFoundException
The grain retains no task with this identifier.

GetResponseAsync(PollingOptions, CancellationToken)

View source
public Task<DurableTaskResponse> GetResponseAsync(PollingOptions options, CancellationToken cancellationToken = default(CancellationToken))
Waits for the task's terminal response, polling with options.

Parameters

optionsPollingOptions
The options of each poll.
cancellationTokenCancellationToken
A token which abandons the wait. It doesn't cancel the task.

Exceptions

Orleans.Durable.Tasks.DurableTaskNotFoundException
The grain retains no task with this identifier.

GetStatusAsync(PollingOptions, CancellationToken)

View source
public Task<DurableTaskStatus> GetStatusAsync(PollingOptions options = default(PollingOptions), CancellationToken cancellationToken = default(CancellationToken))
Polls the task and returns its current status.

Parameters

optionsPollingOptions
The options of the poll.
cancellationTokenCancellationToken
A token which abandons the poll.

Exceptions

Orleans.Durable.Tasks.DurableTaskNotFoundException
The grain retains no task with this identifier.

IsCompletedAsync(PollingOptions, CancellationToken)

View source
public Task<bool> IsCompletedAsync(PollingOptions options = default(PollingOptions), CancellationToken cancellationToken = default(CancellationToken))
Polls the task and returns whether it is terminal.

Parameters

optionsPollingOptions
The options of the poll.
cancellationTokenCancellationToken
A token which abandons the poll.

Exceptions

Orleans.Durable.Tasks.DurableTaskNotFoundException
The grain retains no task with this identifier.

RunAsync(DurableTaskContext)

override
View source
protected internal override ValueTask<DurableTaskResponse> RunAsync(DurableTaskContext context)
Runs the definition in the supplied execution context.

Parameters

contextDurableTaskContext

WaitAsync(CancellationToken)

View source
public ConfiguredScheduledTaskAwaitable<TResult> WaitAsync(CancellationToken cancellationToken = default(CancellationToken))
Waits for the task's successful result.

Parameters

cancellationTokenCancellationToken
A token which abandons the wait. It doesn't cancel the task.

Returns

An awaitable which returns the result, or throws the task's failure or cancellation.