Configuring Job Queues
Configuring Job Queues — Hangfire Documentation
Hangfire can process multiple queues. If you want to prioritize your jobs, or split the processing across your servers (some processes for the archive queue, others for the images queue, etc), you can tell Hangfire about your decisions.
https://docs.hangfire.io/en/latest/background-processing/configuring-queues.html
You can force background workers to only subscribe to tasks with a specified queue name.
Client
[Queue("alpha")]
public void SomeMethod() { }
BackgroundJob.Enqueue(() => SomeMethod());
Background Worker
Note: the lower the index of the queue name will have the higher priority in processing order
public void ConfigureServices(IServiceCollection services)
{
// Add the processing server as IHostedService
services.AddHangfireServer(options =>
{
options.Queues = new[] { "alpha", "beta", "default" };
});
}