Get Started
| Product | Versions |
|---|---|
| .NET Standard |
README
Hangfire extension that guarantees sequential execution of specific jobs
Why sequential jobs?
Some workloads must never overlap, for example:
- Importing data from an external system where each run depends on the previous one.
- Updating shared resources that are not fully concurrency-safe.
- Long-running workflows where the business rules require strict ordering.
With this package, you can keep using Hangfire's background processing and retries, while ensuring that certain jobs follow a strict sequence.
Getting started
Add the Hangfire.Community.SequentialJob NuGet package to your project using the NuGet Package Manager or run the following command:
dotnet add package Hangfire.Community.SequentialJob
By decorating your Hangfire jobs with the SequentialJobAttribute, you can ensure that all jobs sharing the same sequence identifier are processed one after another, in enqueueing order, instead of running in parallel.
[SequentialJob("orders")]
public class OrdersProcessor
{
public async Task<string> RunAsync(int orderId)
{
// Actually process the order …
return $"Order {orderId} processed";
}
}
The sequence identifier can contain a composite format string that will be replaced by the job actual arguments.
The example below uses one sequence per customer. For customer 1234, the sequence identifier will be orders-1234.
[SequentialJob("orders-{1}")]
public class OrdersProcessor
{
public async Task<string> RunAsync(int orderId, int customerId)
{
// Actually process the order …
return $"Order {orderId} processed for customer {customerId}";
}
}
Credits
Thanks to Damien Braillard (@DamienBraillard) who worked with me on this package.
Downloads by Version
Similar & Alternative Packages
Hand-picked matching NuGet libraries based on tags & ecosystem
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.