Skip to content

IDurableHttpClient Methods

Sends HTTP requests and runs HTTP operations as steps of durable tasks, so retries and replays of a task reach the same server-side work.

CancelOperationAsync(Uri, string?)

abstract
public abstract DurableTask<DurableOperation> CancelOperationAsync(Uri operationLocation, string? reason = null)
Requests cancellation of an operation with POST {status monitor}:cancel, as a step of the calling task.

Parameters

operationLocationUri
The URL of the operation's status monitor.
reasonstring?
The reason which the operation's task reads, or null for none.

Returns

A durable task which returns the operation's status: running while its cancellation proceeds, or terminal.

Exceptions

System.Net.Http.HttpRequestException
The response doesn't have a success status code.

GetOperationAsync(Uri)

abstract
public abstract DurableTask<DurableOperation> GetOperationAsync(Uri operationLocation)
Reads an operation's status monitor, as a step of the calling task.

Parameters

operationLocationUri
The URL of the operation's status monitor.

Returns

A durable task which returns the operation's status, and its result or error once it is terminal.

Exceptions

System.Net.Http.HttpRequestException
The response doesn't have a success status code.

SendAsync(Func<HttpRequestMessage>)

abstract
public abstract DurableTask<DurableHttpResponse> SendAsync(Func<HttpRequestMessage> createRequest)
Sends the request which createRequest creates, as a step of the calling task.

Parameters

createRequestFunc<HttpRequestMessage>
Creates the request; it runs for each attempt of the step.

Returns

A durable task which returns the recorded response, whichever its status code.

SignalOperationAsync(Uri, string, T)

abstract
public abstract DurableTask SignalOperationAsync<T>(Uri operationLocation, string signalName, T value)
Delivers a signal with a JSON value to an operation with POST {status monitor}/signals/{name}, as a step of the calling task.

Parameters

operationLocationUri
The URL of the operation's status monitor.
signalNamestring
The signal's name.
valueT
The signal's value.

Returns

A durable task which completes once the operation holds the signal.

Exceptions

System.Net.Http.HttpRequestException
The response doesn't have a success status code, such as 409 Conflict for an operation which holds another value or completed without the signal.

StartOperationAsync(Func<HttpRequestMessage>)

abstract
public abstract DurableTask<DurableHttpOperation> StartOperationAsync(Func<HttpRequestMessage> createRequest)
Sends the request which starts an operation, as a step of the calling task, and returns the operation.

Parameters

createRequestFunc<HttpRequestMessage>
Creates the request; it runs for each attempt of the step.

Returns

A durable task which returns the operation, which the start response may already have completed.

Exceptions

System.Net.Http.HttpRequestException
The response reports neither an operation nor a result, or accepts the request without locating its operation.

WaitForOperationAsync(DurableHttpOperation, DurableHttpOperationOptions?)

abstract
public abstract DurableTask<TResult> WaitForOperationAsync<TResult>(DurableHttpOperation operation, DurableHttpOperationOptions? options = null)
Durably waits for an operation's result.

Parameters

operationDurableHttpOperation
The operation which IDurableHttpClient returned.
optionsDurableHttpOperationOptions?
Configures the wait, or null for the defaults.

Returns

A durable task which returns the operation's result.

Exceptions

Orleans.Durable.Http.DurableHttpOperationException
The operation failed or was canceled.
System.Net.Http.HttpRequestException
A response has a status code which reports neither a status nor a result.

WatchOperationAsync(Uri, CancellationToken)

abstract
public abstract IAsyncEnumerable<DurableOperation> WatchOperationAsync(Uri operationLocation, CancellationToken cancellationToken = default(CancellationToken))
Streams an operation's statuses from the server-sent events of {status monitor}/events until the operation is terminal.

Parameters

operationLocationUri
The URL of the operation's status monitor.
cancellationTokenCancellationToken
Stops the stream.

Returns

The operation's statuses, which end with its terminal status.

Exceptions

System.Net.Http.HttpRequestException
A response doesn't have a success status code.