Beginner Question (Queuing, Listing Jobs)

Hi there,

I currently have Hangfire all working fine. It creates the jobs/tasks etc all fine. I’ve dug round the site and forums to find out how to place tasks in a certain queue but it doesn’t seem to work. So I’m after a sanity check of am I doing this right.

So to create my separate queues I am instantiating Hangfire like the following…

public void ConfigureHangfire(IAppBuilder app)
    app.UseHangfire(config =>
              config.UseServer("Billing", "SystemActions");
              config.UseAuthorizationFilters(new AuthorizationFilter
                      Roles = "Administrator"

This when I log into the Hangfire dashboard and enter the servers section I see my server created with the two queues listed.

My job is just a test job current which is as follows.

    public void ChargeCustomer(int userId)
        Console.WriteLine("This is a test");

Then as a test for now I create a job upon login of the user like…

BackgroundJob.Schedule(() => _subscription.ChargeCustomer(123), TimeSpan.FromDays(1));

It still creates the job in the default queue. I’ve tried the other methods such as ‘Enqueue’ but still get the exact same result.

Am I doing something wrong?

Also is there a way in the API to search for existing jobs? I plan to use Hangfire to trigger my billing system for subscriptions so if the user wants to cancel their subscription then I need to find the job I scheduled for in x months time and delete it. Do I need to store the jobIds created and manage the state myself? Query the tables myself? Or is there something built in?

Now raised the Queue question as a bug after following documentation on the site which doesn’t work. Either documentation is outdated or the code doesn’t work as intended.


var queues = new BackgroundJobServerOptions
Queues = new[] { “critical”, “default” }


        BackgroundJob.Enqueue(() => this.mytask);

    public async Task<bool> mytask() {


Esta pagina es una mierda, la opción para editar una respuesta esta muy culera.