InuvanoLabs.Azure.Functions.FluentDurableTask 1.0.1

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 and Polyglot Notebooks. 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 Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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
1.0.1 451 7/29/2022
1.0.0 437 7/21/2022