Hi,
to use hangfire, i do: Configuration.BackgroundJobs.UseHangfire(configuration => { configuration.GlobalConfiguration.UseSqlServerStorage("Default"); });
but how can i pass a queue configuration to hangfire as described below in the hangfire documentation: <a class="postlink" href="http://docs.hangfire.io/en/latest/background-processing/configuring-queues.html">http://docs.hangfire.io/en/latest/backg ... ueues.html</a>
thank's in advance martin
3 Answer(s)
-
0
Hi,
Have you tried to add
app.UseHangfireServer(new BackgroundJobServerOptions { Queues = new[] { "critical", "default" } });to Startup.cs right under the like
app.UseHangfireDashboard();Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
thanks a lot - it works.
Now i ran into another problem. my main website should only start backgroundjobs and display it's progress etc. (including hangfire dashboard)
and a second "worker" website - hosted on another server should process the jobs.
so i tried:
Configuration.BackgroundJobs.IsJobExecutionEnabled = false;in the website (webmodule->PreInitialize()) to prevent processing. But i seams that this setting is beeing ignored. Website is processing jobs too.
Is there another option to prevent processing jobs by hangfire? any hint for me?
best regards Martin
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
When you use
app.UseHangfireServer(new BackgroundJobServerOptions { Queues = new[] { "critical", "default" } });regardless of the value "IsJobExecutionEnabled" hangfire server starts. <a class="postlink" href="http://docs.hangfire.io/en/latest/background-processing/processing-jobs-in-web-app.html#using-owin-extension-methods">http://docs.hangfire.io/en/latest/backg ... on-methods</a>
So instead of setting "Configuration.BackgroundJobs.IsJobExecutionEnabled" to false, you can conditionally run the "app.UseHangfireServer" code.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)