LevelUp.Bifrost.Concurrency 0.7.2

dotnet add package LevelUp.Bifrost.Concurrency --version 0.7.2
                    
NuGet\Install-Package LevelUp.Bifrost.Concurrency -Version 0.7.2
                    
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="LevelUp.Bifrost.Concurrency" Version="0.7.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LevelUp.Bifrost.Concurrency" Version="0.7.2" />
                    
Directory.Packages.props
<PackageReference Include="LevelUp.Bifrost.Concurrency" />
                    
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 LevelUp.Bifrost.Concurrency --version 0.7.2
                    
#r "nuget: LevelUp.Bifrost.Concurrency, 0.7.2"
                    
#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 LevelUp.Bifrost.Concurrency@0.7.2
                    
#: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=LevelUp.Bifrost.Concurrency&version=0.7.2
                    
Install as a Cake Addin
#tool nuget:?package=LevelUp.Bifrost.Concurrency&version=0.7.2
                    
Install as a Cake Tool

<picture> <source media="(prefers-color-scheme: dark)" srcset="docs/brand/bifrost-lockup-dark.svg"> <img src="docs/brand/bifrost-lockup-light.svg" alt="Bifrost" height="56"> </picture>

Bifrost is a .NET library for running background jobs at a pace your app and its dependencies can handle.

Say 100 users request a PDF at once, and your renderer can handle 10 jobs at a time. If every request calls await RenderAsync(), all 100 can reach the renderer. With Bifrost, you can run 10 jobs at a time, queue up to 50 more, and ask later callers to try again when the queue is full.

Register a typed handler and set your limits. Bifrost runs the jobs and lets you choose how to share worker capacity. You can give interactive jobs priority over batch work or keep one busy tenant from taking all the worker slots.

The default queue runs in your app’s memory. If accepted jobs need to survive a restart, use the optional PostgreSQL-backed service. Your app can confirm that a job is queued and let callers check its status later. On-demand and scheduled jobs can share the same worker pool.

Design

Of 100 PDF jobs submitted without waiting for queue space, 10 are running, 50 are waiting in the full queue, and 40 were rejected.

The queue limits how much work can wait. The worker pool limits how much can run at once. An available worker takes the next eligible job and invokes its handler. Acceptance confirms the job entered the queue. Use a tracked receipt when the caller needs the outcome.

Bifrost job lifecycle in two modes. The in-process library uses a memory queue and optional completion receipt. The durable service accepts HTTP and Quartz work into PostgreSQL, runs it in a worker pool, and exposes saved status by work ID.

Core concepts

<a name="priority-dispatch"></a>

Dispatch When it fits
FIFO Take independent jobs in the order they arrived. When the queue fills, callers can wait for space or try to submit immediately.
Keyed Limit how many jobs can wait or run for one session, account, or other key. Other keys can still use free workers in the same process.
Priority Let interactive jobs move ahead of batch work and reserve queue space for higher-priority jobs under load. Choose exact or relaxed ordering.

<a name="scheduling"></a>

  • Failure handling. Set handler timeouts, opt into retries for transient failures, and capture final failures in a dead-letter queue.
  • Worker capacity and visibility. Scale the pool with demand. Use health checks for service status and OpenTelemetry for queue wait, rejections, and handler outcomes.
  • Scheduling and recovery. Run interval, cron, or one-shot jobs with the in-process scheduler. For jobs that need to survive a restart, the durable execution service stores accepted jobs in PostgreSQL and uses Quartz to send scheduled jobs to the same pools as on-demand work.

Packages

Bifrost targets .NET 10. Start with LevelUp.Bifrost and add the integrations you need.

Package Purpose
LevelUp.Bifrost In-process queues, worker pools, dispatch, and typed handlers
LevelUp.Bifrost.Core Orchestrator abstractions and options
LevelUp.Bifrost.Concurrency Standalone concurrent priority queues
LevelUp.Bifrost.Resilience Polly policies for submission and handler execution
LevelUp.Bifrost.HealthChecks .NET health check integration
LevelUp.Bifrost.OpenTelemetry Queue, worker, and handler metrics
LevelUp.Bifrost.Scheduling In-process scheduling and dispatch
LevelUp.Bifrost.Scheduling.Core Scheduling abstractions
LevelUp.Bifrost.Scheduling.Testing Scheduler test helpers

Example

The Agent Framework sample runs one turn per chat session at a time while other sessions keep moving. It runs offline from a source checkout.

dotnet run -c Release --project samples/Bifrost.AgentFramework.Sample

<details> <summary>C# configuration examples</summary>

Register an orchestrator and submit a job

services.AddWorkOrchestrator<ResizeImage>(options =>
    {
        options.Capacity = 256;
        options.WorkerCount = 4;
    })
    .WithHandler<ResizeImage, ResizeImageHandler>()
    .Build();
services.AddWorkOrchestratorHostedService<ResizeImage>();
var result = await writer.EnqueueAsync(new ResizeImage(imageId));
if (!result.IsAccepted)
{
    logger.LogWarning("Resize {ImageId} was rejected: {Reason}", imageId, result.Reason);
}

Limit concurrency per session

services.AddWorkOrchestrator<Turn>(options => options.Capacity = 512)
    .WithKeyedDispatch(
        static turn => (turn.TenantId, turn.SessionId),
        maxPendingPerKey: 8,
        maxConcurrencyPerKey: 1)
    .WithScopedHandler(static async (services, turn, ct) =>
    {
        var runner = services.GetRequiredService<TurnRunner>();
        await runner.RunAsync(turn, ct);
    })
    .WithHandlerResilience(options => options.AttemptTimeout = TimeSpan.FromMinutes(2))
    .Build();
var result = await writer.EnqueueAsync(turn);
var reply = result.Reason switch
{
    null => "Your message is queued.",
    RejectionReason.KeyLimitExceeded => "This session already has messages waiting. Try again soon.",
    RejectionReason.CapacityExceeded => "The service is busy. Try again later.",
    _ => "The service is shutting down.",
};

Retry a transient handler failure

services.AddWorkOrchestrator<SendInvoice>()
    .WithHandler<SendInvoice, SendInvoiceHandler>(ServiceLifetime.Scoped)
    .WithHandlerResilience(options =>
    {
        options.AttemptTimeout = TimeSpan.FromSeconds(30);
        options.MaxRetries = 2;
        options.ShouldRetry = static ex => ex is HttpRequestException;
    })
    .WithDeadLetterQueue(options => options.MaxRetries = 0)
    .WithAdmissionResilience()
    .Build();

</details>

Build and contribute

Install the .NET 10 SDK specified in global.json. From a source checkout, build and run the tests.

dotnet build src/Bifrost.sln -c Release
dotnet test --solution src/Bifrost.sln -c Release

See the documentation index, releases, and Apache 2.0 license.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LevelUp.Bifrost.Concurrency:

Package Downloads
LevelUp.Bifrost

Channel-based work orchestration library with autoscaling, resilience, health checks, and OpenTelemetry support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.2 0 12/2/2026
0.7.1 102 11/30/2026
0.7.0 108 11/30/2026
0.7.0-rc.1 106 11/26/2026
0.6.3-rc.1 102 11/25/2026
0.6.2 178 11/13/2026
0.6.0 3,722 10/29/2026
0.5.2 18,641 7/7/2026
0.5.1 862 6/22/2026
0.5.0 2,390 6/16/2026