Fleans.ExternalTasks.Sdk
0.11.0
dotnet add package Fleans.ExternalTasks.Sdk --version 0.11.0
NuGet\Install-Package Fleans.ExternalTasks.Sdk -Version 0.11.0
<PackageReference Include="Fleans.ExternalTasks.Sdk" Version="0.11.0" />
<PackageVersion Include="Fleans.ExternalTasks.Sdk" Version="0.11.0" />
<PackageReference Include="Fleans.ExternalTasks.Sdk" />
paket add Fleans.ExternalTasks.Sdk --version 0.11.0
#r "nuget: Fleans.ExternalTasks.Sdk, 0.11.0"
#:package Fleans.ExternalTasks.Sdk@0.11.0
#addin nuget:?package=Fleans.ExternalTasks.Sdk&version=0.11.0
#tool nuget:?package=Fleans.ExternalTasks.Sdk&version=0.11.0
Fleans.ExternalTasks.Sdk
Write Fleans custom-task workers — the code behind <bpmn:serviceTask type="…">. A worker process
built on this package is a plain .NET generic host that connects to a Fleans API over
gRPC (or gRPC-Web): it receives the tasks of the types it implements, runs them, and reports
the outcome. It joins no Orleans cluster, so it needs no clustering, streaming or reminder
configuration — only the API's URL. The package has no Orleans dependency, direct or transitive.
Minimum worker
using System.Dynamic;
using Fleans.ExternalTasks.Sdk;
public sealed class MyHandler(IHttpClientFactory http) : ExternalTaskHandler
{
public override async Task<IDictionary<string, object?>> ExecuteAsync(
IDictionary<string, object?> resolvedInputs, // the task's evaluated input mappings
ExpandoObject variables, // workflow variables visible to the task
ExternalTaskContext context, // ids; ActivityInstanceId = idempotency key
CancellationToken cancellationToken)
{
if (!resolvedInputs.ContainsKey("orderId"))
throw new ExternalTaskFailedException("MISSING_ORDER", "orderId is required"); // BPMN error code
// ... your work ...
return new Dictionary<string, object?> { ["__response"] = new { ok = true } };
}
}
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddFleansExternalTaskWorker(); // binds Fleans:ExternalTaskWorker
builder.Services.AddExternalTaskHandler<MyHandler>("my-task", displayName: "My Task");
builder.Build().Run();
Fleans__ExternalTaskWorker__EngineUrl=http://fleans-api:8080 dotnet run
Configuration (Fleans:ExternalTaskWorker)
| Key | Default | |
|---|---|---|
EngineUrl |
— (required) | The Fleans API base URL. |
WorkerName |
{machine}-{pid} |
Shown in the custom-task catalog; unique per process. |
UseGrpcWeb |
true |
gRPC-Web over HTTP/1.1 works against any API endpoint and proxy. Set false for native gRPC when the endpoint speaks HTTP/2 (TLS, or Kestrel Protocols=Http2). |
AccessToken |
— | Bearer token for an API with Authentication:Authority set (or set AccessTokenProvider in code). |
MaxConcurrentTasks |
32 |
Tasks run at once; further assignments wait in-process. |
ReconnectDelay |
5s |
Pause before re-subscribing after the connection drops. |
Delivery contract
- At-least-once: handlers must be idempotent. A task whose worker disconnects, crashes, or
exceeds the engine's
Fleans:ExternalTasks:ExecutionTimeoutis delivered again — possibly to another worker. Key external side effects bycontext.ActivityInstanceId, which stays the same across deliveries. - No connected worker. The task waits, within the engine's stream delivery window
(
Fleans:Streaming:MaxEventDeliveryTime, 6 minutes by default). Past it the engine stops offering the task, and the activity stays active until reported over REST. - Failures.
ExternalTaskFailedException(code, message)fails the activity with that BPMN error code (catchable by an error boundary event); any other exception fails it with500. - Cancellation is not failure. The token fires when the engine stops waiting (timeout,
shutdown), the connection drops, or the host stops. The task is not reported and is delivered
again. After a dropped connection the worker re-subscribes after
ReconnectDelay. - Deferring. Return
ExternalTaskHandler.Deferredwhen the outcome comes later: the activity stays active, with no timeout, untilPOST /Execution/complete-activityorfail-activityquotescontext.ActivityInstanceId. A redelivery can still run the handler again, so record the task idempotently first. - Wildcards.
AddExternalTaskHandler<T>("<scheme>:*")claims every<scheme>:…type no worker claims exactly. A wildcard is not listed in the catalog. - Editor metadata.
parameterSchema(ExternalTaskParameterSchema) renders typed inputs;category,visibility(ExternalTaskVisibility) andallowedProcessKeyswork as in the catalog. - Inputs, variables and the result cross the wire as JSON.
Other languages: generate a client from protos/external_task_worker.proto, shipped in this
package (src/Fleans/Fleans.ExternalTasks.Sdk/Protos/).
See the external workers guide.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Google.Protobuf (>= 3.33.0)
- Grpc.Net.Client (>= 2.76.0)
- Grpc.Net.Client.Web (>= 2.76.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Fleans.ExternalTasks.Sdk:
| Package | Downloads |
|---|---|
|
Fleans.Plugins.RestCaller
Fleans REST caller plugin — backs <serviceTask type="rest-call"> with an HTTP request. |
|
|
Fleans.Plugins.CamundaExternalTask
Fleans Camunda 7 External Task compatibility plugin — queues <serviceTask type="camunda:topic"> in a table and serves the Camunda 7 /external-task REST API so existing external-task workers keep working unchanged. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.11.0 | 0 | 11/6/2026 |