Sisu.DurableTask.AspNetCore 0.0.1

dotnet add package Sisu.DurableTask.AspNetCore --version 0.0.1                
NuGet\Install-Package Sisu.DurableTask.AspNetCore -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sisu.DurableTask.AspNetCore" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sisu.DurableTask.AspNetCore --version 0.0.1                
#r "nuget: Sisu.DurableTask.AspNetCore, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sisu.DurableTask.AspNetCore as a Cake Addin
#addin nuget:?package=Sisu.DurableTask.AspNetCore&version=0.0.1

// Install Sisu.DurableTask.AspNetCore as a Cake Tool
#tool nuget:?package=Sisu.DurableTask.AspNetCore&version=0.0.1                

Self-Hosted Durable Task Worker in Asp .Net Core

This project enables running DurableTask without a sidecar project, allowing the worker to be self-hosted. It provides a seamless way to integrate Durable Task functionality directly into your Asp .Net Core project.

Usage

Install the NuGet version (Sisu.DurableTask.AspNetCore) package.

dotnet add package Sisu.DurableTask.AspNetCore

[!NOTE] To respect the DurableTask domain and reserve it for official packages, I added a prefix to the project assembly. In Finnish culture, sisu represents determination, perseverance, and resilience, which felt like a fitting touch!

Then, register the host with your preferred orchestration service

using DurableTask.AspNetCore;
using DurableTask.AzureStorage;

var orchestrationServiceAndClient = new AzureStorageOrchestrationService(new()
{
    StorageAccountClientProvider = new StorageAccountClientProvider("...."),
});

builder.Services.AddSelfHostedDurableTaskHub(orchestrationServiceAndClient);

Finally, register the durabletask-dotnet services and add UseSelfHosted to both the worker and client.

using Microsoft.DurableTask;
using Microsoft.DurableTask.Client;
using Microsoft.DurableTask.Worker;

// Add all the generated tasks
builder.Services.AddDurableTaskWorker(builder =>
{
    builder
        .AddTasks(r => r.AddAllGeneratedTasks());
        .UseSelfHosted();
});

builder.Services.AddDurableTaskClient(b => b.UseSelfHosted());

Now you can inject the DurableTaskClient into your classes to schedule or manage durable tasks. For more detailed examples, check out the samples folder.

Under the Hood

The durabletask-dotnet project is built on top of the Durable Task Framework. It provides an easy way to run durable tasks using Dependency Injection and IHostedService as a background service in your application. One of its standout features is a type-safe source generator for orchestrators and activities, making it a breeze to work with. However, "It's specifically designed to connect to a "sidecar" process, such as the Azure Functions .NET Isolated host, a special purpose sidecar container, or potentially even Dapr.", so it use gRPC to communicate with the sidecar. In this project the gRPC communication is replaced with a direct call to the DurableTaskHub service that runs in the same process.

Acknowledgements

durabletask-dotnet for providing the core Durable Task framework.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 73 12/28/2024