Skip to main content

Background jobs for .NET, in the database you already run.

Warp runs jobs, pub/sub messages and in-process requests on PostgreSQL or SQL Server through your own EF Core DbContext. A job is saved in the same transaction as the data it belongs to, and there is no broker to operate.

.NET 10 and 11. PostgreSQL 17 and 18, SQL Server 2022 and 2025. MIT licensed.

OrderService.cs
public async Task PlaceOrder(Order order, CancellationToken ct)
{
db.Orders.Add(order);

// Saved in the same transaction as the order.
await publisher.Enqueue(
new SendConfirmationEmail { OrderId = order.Id });

await db.SaveChangesAsync(ct);
}

public class SendConfirmationEmailHandler(IEmailSender email)
: IJobHandler<SendConfirmationEmail>
{
public Task HandleAsync(
SendConfirmationEmail job, CancellationToken ct) =>
email.SendConfirmation(job.OrderId, ct);
}
The Warp dashboard: job counts by state and live throughputThe Warp dashboard: job counts by state and live throughput

Jobs commit with your data

Warp writes through your DbContext, so an order and the email job it needs are saved together or not at all. No outbox table to build, no dual write to reconcile.

How the outbox works

Light on the database

Jobs are claimed in batches and completed in batches. An empty job costs as few as 0.22 database statements, so the queue leaves the server to the rest of your application.

Performance

Nothing to register

A source generator finds your handlers at build time and dispatches to them without reflection. Write the handler class and it runs.

Getting started

A dashboard that explains what happened

Served at /warp from your own application, behind your own authorization. These are captures of the dashboard running its demo data.

Every attempt, with the reason it failed

A job page shows the payload, the metadata, and each state the job passed through with its duration and exception. Requeue or delete it from the same page.

Jobs in the dashboard
A failed job: payload, metadata and the history of every attemptA failed job: payload, metadata and the history of every attempt

Handler logs while the job is still running

What the handler writes to ILogger appears on the job page about a second later, next to the progress it reports. You do not need to wait for the job to finish, or go to another tool, to see what it is doing.

Live output and progress
A running job with reported progress and live handler outputA running job with reported progress and live handler output

One trace from the request to the last job

Follow a checkout from the browser, through the endpoint, into the job it enqueued, the outbound call that job made and the jobs that followed. The job graph shows batches, messages and continuations.

Tracing across jobs
A trace from a browser request through an endpoint to the jobs it startedA trace from a browser request through an endpoint to the jobs it started

Four thousand failures, one issue

Errors from jobs, endpoints, outbound calls and the browser are grouped by fingerprint. Mark an issue resolved and Warp flags it as regressed if it comes back.

Error grouping
Errors grouped into issues with event counts and statusErrors grouped into issues with event counts and status

The queue shares your database. It should not crowd it.

The same 20,000 jobs on the same PostgreSQL server, one server with 10 workers, Warp 8.0 (with prefetch) against Hangfire 1.8. With the default of no prefetch an empty job costs about 0.46 statements.

Drain 20,000 empty jobs
Warp2.1 s
Warp, single-worker11.2 s
Hangfire34.7 s
Drain 20,000 jobs that read and update a row
Warp5.3 s
Warp, single-worker13.8 s
Hangfire36.4 s
MeasurementWarpHangfire
Database statements per empty job0.2240.03
Database time per empty job0.061 ms3.444 ms
Memory allocated per empty job15.2 KB75.0 KB

Shorter is better. Each value is the median of 3 runs. Warp is shown in dispatcher mode, the default since 8.0, and the table compares that mode with Hangfire. Every measured row, the method and the caveats.

Four kinds of work, one handler model

Durable work and in-process calls share one pipeline, so a behavior you write once, such as logging or validation, wraps all four.

JobsIJob
One handler. Stored, retried, scheduled, grouped into batches.
MessagesIMessage
Any number of handlers. Each one runs as its own job.
RequestsIRequest<T>
In-process, typed response. Nothing is stored.
StreamsIStreamRequest<T>
In-process IAsyncEnumerable. Nothing is stored.
// Job: one handler, stored, retried
await publisher.Enqueue(new GenerateReport { Month = 3 });
await publisher.Schedule(new GenerateReport { Month = 4 }, tomorrow);

// Message: every handler runs as its own job
await publisher.Publish(new OrderCreated { OrderId = order.Id });

// Request: in-process, typed response, no database
var user = await mediator.Send(new GetUser { UserId = 1 });

// Stream: in-process IAsyncEnumerable
await foreach (var item in mediator.CreateStream(new GetUsers { Role = "Admin" })) { }

Run your first job

Four packages and the database you have. Warp adds its tables to your model, so your normal migrations create them.

  1. Add the packages

    dotnet add package Moberg.Warp.Core
    dotnet add package Moberg.Warp.Worker
    dotnet add package Moberg.Warp.Provider.PostgreSql # or .SqlServer
    dotnet add package Moberg.Warp.Dashboard
  2. Register Warp on your DbContext

    Program.cs
    builder.Services.AddDbContext<AppDbContext>(o => o.UseNpgsql(connectionString));

    builder.Services.AddWarpServer<AppDbContext>(opt =>
    {
    opt.UsePostgreSql(); // or opt.UseSqlServer()
    opt.AddRetry(r => r.MaxRetries = 3);
    });

    var app = builder.Build();
    app.MapWarpDashboard("/warp");
    app.Run();
  3. Create the tables

    dotnet ef migrations add AddWarp
    dotnet ef database update