Recurring tasks not enqueued to MSMQ

Hi all,

I’m having an issue getting jobs that were added to SQL server to enqueue into MSMQ. As far as I can tell, MSMQ is configured correctly. In the Hangfire dashboard, the jobs are processed successfully but I never see them actually enter the MSMQ queue. I would expect that, if I do not have a Hangfire server running to process the job, the queue would just fill indefinitely but that isn’t happening. Does something look wrong here? This is my set up code in the OWIN startup class.

 app.UseHangfire(config =>
    {
                config.UseAutofacActivator(Container);
                string queue = Container.Resolve<IQueueingConfiguration>().UnorderedCommandQueue;

                if (!MessageQueue.Exists(queue))
                {
                    MessageQueue.Create(queue, true);
                }

                config.UseSqlServerStorage("HangfireDb")
                      .UseMsmqQueues(queue, "default");

                config.UseServer("default");
            });

The “queue” variable is a valid MSMQ path. I know this because it is created correctly in the MSMQ server.

As long as I’m here, I’m seeing another issue I cannot explain. As you can see, I am calling config.UseServer(…) which (I would think) should delete the row for that server from the database when I stop the application. However, that doesn’t happen. The result is that if I debug and stop debugging my application several times, I end up with the Hangfire dashboard telling me I have several instances of the Hangfire server running when in reality there are none.

I am using version 1.3.3 of Hangfire.