I’m working on a project where certain jobs are incompatible and should never be processed in parallel. Currently I have one hangfire job dedicated to queueing up all the other jobs, making sure no incompatible jobs are added to the queue.
One problem with my solution is keeping exactly one instance of this ‘queueing service’ running at once. I would like to have a dedicated queue just for this job, and use the monitoring api to find whether there is a job processing that was added through this queue, but that information does not seem to be available. Right now I’m using a cancellation token for this service, so that it exits when the server shuts down, but occasionally I’m finding more than one instance processing at once.
Is there a good way to do this, or a better solution to my problem in general?