I have two BackgroundJobServers set up as follows:
backgroundJobServer.Add(new BackgroundJobServer(new BackgroundJobServerOptions {
ServerName = String.Format("{0}:Default", Environment.MachineName)
}));
backgroundJobServer.Add(new BackgroundJobServer(new BackgroundJobServerOptions {
ServerName = String.Format("{0}:JobAtATime", Environment.MachineName),
WorkerCount = 1,
Queues = new[] { "JobAtATime" }
}));
I can see these both of these in my list of Servers, with the correct Server Name and Worker Count, so I presume they should be working as expected.
I also have the the following Recurring Jobs:
RecurringJob.AddOrUpdate<TaskA>("TaskA", j => j.DoSomething(), Cron.Minutely)
RecurringJob.AddOrUpdate<TaskB>("TaskB", j => j.DoSomething(), Cron.Minutely)
RecurringJob.AddOrUpdate<TaskC>("TaskC", j => j.DoSomething(), Cron.Minutely);
If I mark up one of my tasks with the Queue Attribute:
public class TaskA {
[Queue("JobAtATime")]
public void DoSomething() {
//Do Something
}
}
I’m finding that the Job is never Enqueued and all other recurring Jobs that occur after it are no longer Enqueued either.
I don’t have any visible errors here, as far as I can tell, but when I remove the Queue attribute my Recurring Jobs start Enqueuing again on the Default queue.
Am I missing something obvious here…?
For reference, I’m running Hangfire 1.4.1, using SqlServerStorage, my JobActivator uses Windsor to resolve dependancies and I use the DisableConcurrentExecutionAttribute in the GlobalJobFilters.
If there’s any relevant detail in my setup I may have missed in this post, please let me know.
Thanks!
EDIT:
If it’s of any use, the Job with the QueueAttribute seems to be inserted in the Job Table with StateId and StateName set to null.