InuvanoLabs.Azure.Functions.FluentDurableTask 1.0.1

.NET 6.0
dotnet add package InuvanoLabs.Azure.Functions.FluentDurableTask --version 1.0.1
NuGet\Install-Package InuvanoLabs.Azure.Functions.FluentDurableTask -Version 1.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="InuvanoLabs.Azure.Functions.FluentDurableTask" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InuvanoLabs.Azure.Functions.FluentDurableTask --version 1.0.1
#r "nuget: InuvanoLabs.Azure.Functions.FluentDurableTask, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install InuvanoLabs.Azure.Functions.FluentDurableTask as a Cake Addin
#addin nuget:?package=InuvanoLabs.Azure.Functions.FluentDurableTask&version=1.0.1

// Install InuvanoLabs.Azure.Functions.FluentDurableTask as a Cake Tool
#tool nuget:?package=InuvanoLabs.Azure.Functions.FluentDurableTask&version=1.0.1

Fluent Durable Functions

NuGet

What is Fluent Durable Functions?

Supported Patterns

Chaining

        [FunctionName(nameof(ExampleChainingOrchestration))]
        public static async Task ExampleChainingOrchestration([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger loggerBase)
             => await context
                    .AsFluentOrchestration(loggerBase)
                    .ThenAsync(Activities.RunStaticActivityWithReturnValue)
                    .ThenAsync<Activities>((c) => c.RunNonStaticActivityWithReturnValue)
                    .ThenAsync<Activities, string>((c) => c.RunNonStaticActivityWithReturnValue, (ctx) => new { Name = "Bob Smith" })
                    .Then((ctx) => ctx.Logger.LogInformation($"Activity Result: {ctx.LastStepResult.As<string>()}"))
                    .Then((ctx) => ctx.Logger.LogInformation("Done"));

Fan-Out/In

        [FunctionName(nameof(ExampleFanOutInOrchestration))]
        public static async Task ExampleFanOutInOrchestration([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger loggerBase)
            => await context
                    .AsFluentOrchestration(loggerBase)
                    .Then((ctx) => ctx.Logger.LogInformation("Running Orchestration"))
                    .ThenFanOutAsync<Activities, string>((c) => c.RunNonStaticActivityWithReturnValue, (ctx) => Enumerable.Range(1, 3))
                    .Then((ctx) => ctx.Logger.LogInformation($"Fan Out result: {string.Join(", ", ctx.LastStepResult.As<IEnumerable<string>>())}"))
                    .Then((ctx) => ctx.Context.SetOutput(ctx.LastStepResult.As<IEnumerable<string>>()));

Monitor

        [FunctionName(nameof(ExampleMonitorOrchestration))]
        public static async Task ExampleMonitorOrchestration([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger loggerBase)
            => await context
                    .AsFluentOrchestration(loggerBase)
                    .Then((ctx) => ctx.Logger.LogInformation("Running Orchestration"))
                    .ThenWaitUntilAsync<Activities, string>((c) => c.RunNonStaticActivityWithRandomStatus, (ctx) => "input", 
                        interval: TimeSpan.FromSeconds(2), 
                        expires: TimeSpan.FromSeconds(10),
                        (ctx) => ctx.LastStepResult.As<string>() == "Completed")
                    .Then((ctx) => ctx.Logger.LogInformation("Done"));

External Event

        [FunctionName(nameof(ExampleExternalEventOrchestration))]
        public static async Task ExampleExternalEventOrchestration([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger loggerBase)
             => await context
                     .AsFluentOrchestration(loggerBase)
                     .Then((ctx) => ctx.Logger.LogInformation("Running Orchestration"))
                     .ThenWaitForAsync<object>("Approved", TimeSpan.FromMinutes(1))
                     .When((ctx) => ctx.LastStepResult == null, (ctx) => ctx.Logger.LogInformation("Approval Timeout"))
                     .When((ctx) => ctx.LastStepResult != null, (ctx) => ctx.Logger.LogInformation($"Approval Result: {ctx.LastStepResult.As<object>()}"))
                     .Then((ctx) => ctx.Logger.LogInformation("Done"));

See the Samples project for more details.

How do I get it?

Package available on NuGet https://www.nuget.org/packages/InuvanoLabs.Azure.Functions.FluentDurableTask

Issues? Feedback?

Please file an issue above.

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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
1.0.1 271 7/29/2022
1.0.0 269 7/21/2022