Skip to content

DurableHttpServiceCollectionExtensions Methods

Registers the services which serve durable tasks as HTTP operations.

AddDurableHttp(IServiceCollection, Action<DurableHttpOptions>)

staticextension
View source
public static IServiceCollection AddDurableHttp(this IServiceCollection services, Action<DurableHttpOptions>? configureOptions = null)
Adds the services which the durable operation endpoints use, which DurableHttpEndpointRouteBuilderExtensions and NexusEndpointRouteBuilderExtensions map.

Parameters

servicesIServiceCollection
The service collection, which also provides an Orleans IGrainFactory.
configureOptionsAction<DurableHttpOptions>
Configures the operations, or null for the defaults.

Returns

The service collection.

AddDurableHttpCallbacks(IServiceCollection, Action<DurableCallbackOptions>)

staticextension
View source
public static IHttpClientBuilder AddDurableHttpCallbacks(this IServiceCollection services, Action<DurableCallbackOptions>? configureOptions = null)
Adds the services with which silos deliver callbacks, which requests register with an Operation-Callback header or a Nexus callback, and returns the builder of the System.Net.Http.HttpClient which delivers them.

Parameters

servicesIServiceCollection
The silo's service collection.
configureOptionsAction<DurableCallbackOptions>
Configures delivery, or null for the defaults.

Returns

The builder of the client which delivers callbacks, which configures its handlers, such as a proxy. The client doesn't follow redirects, which retries as undelivered, and connects only to the addresses which DurableCallbackOptions accepts.

AddDurableHttpClient(IServiceCollection, string, Action<DurableHttpClientOptions>)

staticextension
View source
public static IHttpClientBuilder AddDurableHttpClient(this IServiceCollection services, string name, Action<DurableHttpClientOptions>? configureOptions = null)
Adds an IDurableHttpClient, which durable tasks inject as a keyed service named name, and returns the builder of the named System.Net.Http.HttpClient which it sends requests with.

Parameters

servicesIServiceCollection
The silo's service collection.
namestring
The client's name, which keys the service and names the System.Net.Http.HttpClient.
configureOptionsAction<DurableHttpClientOptions>
Configures the client, or null for the defaults.

Returns

The builder of the named client, whose first handler is a DurableIdempotencyKeyHandler, so handlers which the builder adds, such as a resilience handler, retry requests with their keys.

Examples

services.AddDurableHttpClient("payments")
.ConfigureHttpClient(client => client.BaseAddress = new("https://payments.example"))
.AddStandardResilienceHandler();
public sealed class OrderGrain([FromKeyedServices("payments")] IDurableHttpClient payments) : DurableGrain, IOrderGrain