Background Job Scheduling
Current State
I am using multiple Hangfire Servers targeting a single persistence layer. Each application is configured for a specific queue. I have upgraded to start using Hangfire.DynamicJobs so that the application that is implementing the Hangfire UI does not have to be aware of the other applications.
The Question
I want to prevent all but one of my servers from running the BackgroundJob Scheduler. So each server can dequeue and perform work based on the queue it is configured to look at, but I do not want any of them contributing to the enqueuing of work from Recurring Jobs. I want to limit that to a single server. (which will end up being the same server that is responsible for the UI).
Is this possible?
You can set the BackgroundJobServerOptions.IsLightweightServer to true for servers which should contain workers only. In this case, schedulers and some storage-related processes will not be started. But ensure that your environment contains at least one non-lightweight server to ensure that such processes are still handled properly. Also, there was a problem with lightweight servers, long-running jobs and Hangfire.SqlServer storage, please ensure you have the latest version installed.