Durable Functions in the .NET Isolated Worker: A Comprehensive Overview
Durable Functions in the .NET isolated worker offer a powerful way to run your Durable Functions app on a .NET version different from the Azure Functions host. This article provides an overview of the benefits and features of using Durable Functions in the .NET isolated worker.
Why Use Durable Functions in the .NET Isolated Worker?
Utilizing the .NET isolated worker model provides several benefits, including:
Feature Improvements over In-process Durable Functions
The .NET isolated worker SDK includes several feature improvements over in-process Durable Functions, including:
Source Generator and Class-based Activities and Orchestrations
To take advantage of the source generator and class-based activities and orchestrations, follow these steps:
Here's an example of how to implement class-based activities and orchestrations:
领英推荐
// Define activity class
public class MyActivity : TaskActivity<string, string>
{
public override Task<string> RunAsync(TaskActivityContext context, string input)
{
// Implementation
}
}
// Define orchestration class
public class MyOrchestration : TaskOrchestrator<string, string>
{
public override Task<string> RunAsync(TaskOrchestrationContext context, string input)
{
// Implementation
return context.CallActivityAsync<string>(nameof(MyActivity), input);
}
}
Durable Entities
Durable entities are also supported in the .NET isolated worker, providing a powerful way to manage stateful entities within your Durable Functions app.
Migration Guide
If you're migrating from a .NET Durable Functions 2.x project to the .NET isolated worker, follow these steps:
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.0" />
</ItemGroup>
By leveraging Durable Functions in the .NET isolated worker, you can take advantage of the latest features and improvements to build robust and scalable serverless applications.