I’ve created two simple console apps.
One is the client that calls BackgroundJob.Enqueue()
Second is the worker that calls using (var server = new BackgroundJobServer()).
In the client I use IMonitoringApi jobMonitoringApi = JobStorage.Current.GetMonitoringApi() to poll the state of the job (using the JobDetailsDto.History[0].StateName) to know when it is done.
If I first run the worker and only then the client, then the worker runs the job and the client see the ‘StateName’ changes.
The problem:
When I first run the client and then run the worker, then the ‘StateName’ never changes from “Enqueued”.
I was under the impression that you can add workers dynamically at runtime to handle jobs in queue.