How to create non-duplicating recurring job in Hangfire where application is hosted in 2 instances

Tags: #<Tag:0x00007fc903c85220> #<Tag:0x00007fc903c85158> #<Tag:0x00007fc903c84ff0>

Hi All,

I’m new to Hangfire and I have created a Blank core project (Hangfire + SQL) and setup a recurring job that is supposed to run every hour. The job will just send a message to Rabbit MQ and Rabbit MQ will process it from there. I am trying to handle a situation where the same application is deployed in multiple server instances but the recurring job should not be triggered multiple times. The idea is that if the first server instance is down then the jobs should be executed by the second instance. But if both servers are up, the recurring jobs should not get executed twice as there is no way for Rabbit MQ to understand a duplicate message.

Please let me know if anyone has any idea regarding this. Thank You!