Hi, I wonder if anyone could help me with setting up HangFire 1.4.0 with MSMQ and multiple queues.
I have one MVC Web app that creates jobs (when I hit a given page) and one console app that executes all jobs
the MVC web app is set up as follows:
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
GlobalConfiguration.Configuration
.UseSqlServerStorage("Server=localhost; Database=HangFire; Integrated Security=SSPI;")
.UseMsmqQueues(@".\hangfire-{0}", "critical", "default");
app.UseHangfireDashboard(VirtualPathUtility.ToAbsolute("~/BackgroundJobs"));
}
I enqueue the jobs like this:
BackgroundJob.Enqueue(() => Message.WriteCriticalStuff("I'm critical " + new Random().Next()));
BackgroundJob.Enqueue(() => Message.WriteDefaultStuff("I'm default " + new Random().Next()));
Where the messages are defined like this:
[Queue("critical")]
public static void WriteCriticalStuff(string str)
{
Console.WriteLine(str);
}
[Queue("default")]
public static void WriteDefaultStuff(string str)
{
Console.WriteLine(str);
}
My console app is basically jsut this:
GlobalConfiguration.Configuration
.UseSqlServerStorage("Server=localhost; Database=HangFire; Integrated Security=SSPI;")
.UseMsmqQueues(@".\hangfire-{0}", "critical", "default");
using (var server = new BackgroundJobServer())
{
Console.WriteLine("Hangfire Server started. Press any key to exit...");
Console.ReadKey();
}
I cannot for my life get any other message than the ones using the default queue all others are stuck in the database
as ‘enqueued’. Anyone have a clue? Would really appreciate any help.
Edit: I should mention that I have created 2 public MSMQ queues: hangfire-default and hangfire-critical. Both queues have given full permissions to the Everyone user group.As said the hangfire-default seems to be working fine, the other one not so much.