Skip to content

NexusEndpointRouteBuilderExtensions.MapNexusOperation(IEndpointRouteBuilder, string, Delegate)

MapNexusOperation(IEndpointRouteBuilder, string, Delegate)

staticextension
View source
public static RouteGroupBuilder MapNexusOperation(this IEndpointRouteBuilder service, string operation, Delegate handler)
Maps the Nexus operation operation, whose handler returns durable work, such as grain.ChargeAsync(input), which a start request starts as an operation.

Parameters

serviceIEndpointRouteBuilder
The group which NexusEndpointRouteBuilderExtensions returns.
operationstring
The operation name, such as charge, of URL-unreserved characters.
handlerDelegate
A delegate which binds the operation's input, such as from the JSON request body, and other parameters like a Minimal API handler, and returns a durable grain call or a reference to an existing task, which grain.GetDurableTask<T>(id) returns, directly or through a System.Threading.Tasks.Task or System.Threading.Tasks.ValueTask. It runs for each start request, including retries, and only creates the work.

Returns

A group builder which configures the operation's start and cancel endpoints.

Exceptions

System.ArgumentException
operation is empty or has characters other than URL-unreserved ones, or handler doesn't return durable work.