MSMQ with Multiple Servers

Tags: #<Tag:0x00007f066c633318> #<Tag:0x00007f066c6331d8>

I’m having a strange bug where a recurring job only succeeds sometimes. The jobs don’t show up in the Dashboard but the Enqueued counter goes up in the Dashboard, and in the recurring job you can click on the last job and see its details that it’s enqueued.

I found them in the JobQueue table, even though we only use MSMQ. And I think that’s why it’s stuck, because the Hangfire servers never look at the JobQueue table.

Is anyone else having the same problem?

I have Hangfire set up like this:
Multiple apps, each running a Hangfire server. They each handle their own queues.

I have my queues in BackgroundJobServerOptions like here:

otherwise the server only uses the default queue. Shouldn’t the MSMQ documentation be updated?
The example code doesn’t actually work.

These could be related, but they’re a slightly different situation (nothing about MSMQ, and the enqueued job still has the right queue):

I’m not sure how Hangfire works, but I have a theory that a server picks up the job, then looks at the queue, and it decides that it doesn’t handle this queue, so it puts it back onto the queue. But since it doesn’t know about the other server’s queue configuration, it puts it back into JobQueue instead of MSMQ.