HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.4k stars 1.7k forks source link

Recurring Job Queues #704

Open siada opened 8 years ago

siada commented 8 years ago

I've got 2 applications both with their own recurring jobs and I need them to both run on the same SQL database. I've tried assigning queues to the jobs and I've set the BackgroundJobServerOptions.Queues to the queue names I want each app to work from, however both apps are picking up every recurring job and there doesn't seem to be anything in the actual queues (all jobs go into DEFAULT)

This is on app 1:

        RecurringJob.AddOrUpdate<IJob>("Job_app_1", job => job.Run(), Cron.Hourly, TimeZoneInfo.Local, "app_queue_1");
        app.UseHangfireServer(new BackgroundJobServerOptions
        {
            Queues = new [] { "app_queue_1" }
        });

This is on app 2:

        RecurringJob.AddOrUpdate<IJob>("Job_app_2", job => job.Run(), Cron.Hourly, TimeZoneInfo.Local, "app_queue_2");
        app.UseHangfireServer(new BackgroundJobServerOptions
        {
            Queues = new [] { "app_queue_2" }
        });
tstojecki commented 8 years ago

Might be the order, I think you need to run app.UseHangfireServer so it creates the queues first.

siada commented 8 years ago

Sorry bad example really, in the code base they are the other way around, the job is defined after the UseHangfireServer is called.

pbolduc commented 7 years ago

This could be related to #705.