OrcaFlow.Core 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OrcaFlow.Core --version 0.2.0
                    
NuGet\Install-Package OrcaFlow.Core -Version 0.2.0
                    
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="OrcaFlow.Core" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OrcaFlow.Core" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="OrcaFlow.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OrcaFlow.Core --version 0.2.0
                    
#r "nuget: OrcaFlow.Core, 0.2.0"
                    
#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.
#:package OrcaFlow.Core@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OrcaFlow.Core&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=OrcaFlow.Core&version=0.2.0
                    
Install as a Cake Tool

Orca

A lightweight, generic task orchestration library for .NET.
Define tasks, chain them into pipelines, run them sequentially or in parallel, and add conditions – all with a minimal API.


✨ Features

  • Generic context – pass any type as shared state across tasks
  • Fluent builder – chain steps with .AddStep<T>() or .AddStep(instance)
  • Conditional execution – skip steps dynamically with Func<TContext, bool>
  • Parallel execution – group tasks and run them concurrently with ParallelGroupTask
  • Lifecycle hooksOnStepStarted, OnStepCompleted, OnStepFailed
  • Error handling strategiesStopOnError or SkipFailed
  • Cancellation support – via CancellationToken
  • Dependency Injection support with IServiceCollection

🚀 Getting Started

1. Install

NuGet\Install-Package OrcaFlow.Core -Version 0.1.0

2. Define a task

Tasks implement the ITask<TContext> interface:

public sealed class AppendTask : ITask<List<string>>
{
    public string Name { get; }
    private readonly string _msg;

    public AppendTask(string name, string msg)
    {
        Name = name;
        _msg = msg;
    }

    public Task ExecuteAsync(List<string> context, CancellationToken token = default)
    {
        context.Add(_msg);
        return Task.CompletedTask;
    }
}

3. Build an orchestrator

Create a pipeline with sequential and parallel steps:

var builder = new OrchestratorBuilder<List<string>>()
    .AddStep(new AppendTask("A", "one"))
    .AddStep(new AppendTask("B", "two"))
    .AddStep<AppendTask>(ctx => ctx.Count < 5) // conditional with generic new()
    .AddStep(
        new ParallelGroupTask<List<string>>(
            "ParallelGroup",
            new ITask<List<string>>[]
            {
                new AppendTask("P1", "parallel-1"),
                new AppendTask("P2", "parallel-2")
            }))
    .Configure(options =>
    {
        options.ErrorStrategy = ErrorHandlingStrategy.ContinueOnError;
        options.OnStepStarted = async (task, ctx) =>
            Console.WriteLine($"Starting {task.Name}...");
        options.OnStepCompleted = async (task, ctx) =>
            Console.WriteLine($"Completed {task.Name}");
        options.OnStepFailed = async (task, ex, ctx) =>
            Console.WriteLine($"Step {task.Name} failed: {ex.Message}");
        // Middleware
        options.Use(async (task, ctx, next, token) =>
        {
            await next();
        });
    });

var orchestrator = builder.Build();

Or via DependencyInjection

public void ConfigureServices(IServiceCollection services)
{
    // Register services + tasks
    services.AddSingleton<MyService>();
    services.AddTransient<ServiceBackedTask>();
    services.AddTransient<OtherTask>();

    // Register orchestrator via extension
    services.AddOrchestrator<TestContext>(builder =>
    {
        builder.AddStep<ServiceBackedTask>()
               .AddStep<OtherTask>()
               .Configure(o =>
               {
                   o.OnStepStarted = async (task, ctx) =>
                       Console.WriteLine($"Starting {task.Name}...");
               });
    });
}

4. Run the pipeline

var context = new List<string>();

await orchestrator.RunAsync(context);

Console.WriteLine("Items: " + string.Join(", ", context));

Or inject the Orchestrator

public class MyController
{
    private readonly Orchestrator<TestContext> _orchestrator;

    public MyController(Orchestrator<TestContext> orchestrator)
    {
        _orchestrator = orchestrator;
    }

    public async Task<IActionResult> Run()
    {
        var ctx = new TestContext();
        await _orchestrator.RunAsync(ctx);
        return new OkObjectResult(ctx.Log);
    }
}

Example Output:

Starting A...
Completed A
Starting B...
Completed B
Starting AppendTask...
Completed AppendTask
Starting ParallelGroup...
Completed ParallelGroup
Items: one, two, conditional, parallel-1, parallel-2

Roadmap

  • Retry policies (with backoff)

Project Structure

/Orca          → library code
/Orca.Tests  → unit tests
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 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
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.3.0 272 8/30/2025
0.2.0 250 8/30/2025
0.1.0 257 8/30/2025