Hi,
I have a single MSSQL backend with two Windows Services with separate code bases.
Each Service starts a Hangfire server via:
app.UseHangfireServer(new BackgroundJobServerOptions
{
Queues = new[] { "queue-X" }
});
Where X
is the service number.
Then, each of the services enqueues its own jobs via:
RecurringJob.AddOrUpdate(() => JobForServer_1(), Cron.Minutely, queue: "queue-1");
or:
RecurringJob.AddOrUpdate(() => JobForServer_2(), Cron.Minutely, queue: "queue-2");
I’ve also tried the same via the Queue
annotation.
The Servers tab in the dashboard show each correctly listening to its queue.
However, jobs don’t seem to be getting enqueued properly; each server is enqueueing both jobs.
It’s almost as each of the Hangfire servers are picking up both jobs, but because it cannot find one of the codebases it doesn’t realize that one of the jobs is for another queue, and so enqueues both.
Is there a better approach to achieve this?
Thanks!