First off, Hangfire is running prefectly. I have a single server with a dynamic number of queues being created. Jobs assigned to these queues run successfully. Everything is working.
I have been trying to get the status of the queues without success. What I want to do is check the queues periodically and see if they are finished. Problem is I cannot figure out how to do this when:
- The queue has jobs in it
- The queue is empty
The code I have been running is…
Hangfire.Storage.IMonitoringApi monitor = JobStorage.Current.GetMonitoringApi;
Storage.Monitoring.QueueWithTopEnqueuedJobsDto myQ = New Storage.Monitoring.QueueWithTopEnqueuedJobsDto();
foreach (myQ in monitor.Queues) {
txtStatus.Text += “[” + myQ.Name + "] - " + myQ.Length + “\n”;
}
If the queue has jobs in it, the above runs fine. If the queue does not, it returns nothing.
If anyone has a suggestion, I’d really like to hear it.
Thanks