Missing HangFireConfig.cs file when installed via Nuget?

Hi
I have been playing around with Hangfire today and really liking it, but I have come up with a couple of questions.

  1. In the docs (and a few blog postings) I keep seeing references to a HangFireConfig.cs file that should have been installed during the Nuget installation process. I’m not seeing this. I am trying to figure out how to create 2 different named queues in an ASP.Net MVC application. The code that should show in the config file looks like this:
var options = new BackgroundJobServerOptions
{
   Queues = new[] { "critical", "default" }
};
var server = new AspNetBackgroundJobServer( options );

but I can’t figure out where to put this code, otherwise. So when my controller action fires, it puts my job in the new named queue “tester”, but it doesn’t fire. Here is my controller sample:

namespace Hangfire.Client.Controllers
{
    public class TestController : Controller
    {
        public string Fire()
        {
            var id = BackgroundJob.Enqueue(() => System.Diagnostics.Debug.WriteLine("Instant Fire-and-forget"));
            System.Diagnostics.Debug.WriteLine("The job id is: " + id);
            
            id = BackgroundJob.Enqueue<Tester>(y => y.SubmitJobToHangfire("RichardTest"));
            System.Diagnostics.Debug.WriteLine("The job id is: " + id);

            return "Done";
        }
    }

    public class Tester
    {
        [Queue("tester")]
        public void SubmitJobToHangfire(string testString)
        {
            System.Diagnostics.Debug.WriteLine("testString: " + testString);
        }
    }
}

So, I will see Instant Fire-and-forget, but I will never see testString: RichardTest.
Any help would be super appreciated. Thanks.

Sorry, forgot to update those articles with the 1.0 release (they are fixed now). Hm, and Using multiple queues article is missing. Thanks for pointing me about these issues!

If you are using Hangfire inside a web application, please use Hangfire’s OWIN bootstrapper for configurational actions. You can tell Hangfire Server to process multiple queues in very easy way:

app.UseHangfire(config =>
{
    /* other configuration actions */
    config.UseServer("critical", "default");
});

Hi Sergey

I was just about to update my own post with the answer. I discovered it late last night.

It is incredible how responsive you are on this forum. Thanks so much.