Search code examples
hangfire

restricting hangfire to pick up jobs from a specific queue


I have 2 hangfire instances/servers running. Both point to the same hangfire database. How do I restrict one of the hangfire instance to pick up only jobs from a specific queue and ignore other queues?

Thanks


Solution

  • When you start your instance, you can provide a list of queues to be watched by the server:

    app.UseHangfireServer(new BackgroundJobServerOptions()
    {
        // order defines priority
        // beware that queue names should be lowercase only
        Queues = new [] { "critical", "default", "myqueue" } 
    });