I have multiple dynamically named work queues, assigned at run time to backend job servers (one job per server). When a queue finishes, I want to free the work queue and server to make them available to process other jobs.
Is there an API call to get queue status?
Is there an event thrown by Queues when they completes successfully?
What SignalR endpoints are registered in Hangfire Server that can be mapped to my app JobHiub?
var succeededJobs = JobStorage.Current.GetMonitoringApi();
foreach (var succeededJob in succeededJobs.SucceededJobs(0, System.Convert.ToInt32(succeededJobs.SucceededListCount())))
{
…
}
I can monitor queues available for job assignment as the Dashboard does, and I can monitor Servers available for queue assignment. As well, by having the app SignalRHub poll for succeeded jobs in Heartbeat*n intervals, SignalR can clear the server-queue mapped pair for further duty and inform the desktop of jobs that complete in a rolling stream, as they complete. It would be good if a queue state event change could throw a signal through SignalR to registered app hubs so that listening rather than polling could be implemented from the app SignalR hub.
I’m still working my way through documentation supplemented by Hangfire source code. I am sure there are more efficient and elegant ways to implement what I am doing. But at least I am getting it done in the above manner…and can go back and refactor it later as I become more knowledgeable about the API source code.