I’m trying to use the Hangfire.SqlServer.RabbitMQ
plugin on my client console application. When I stop the application, it does not exit. When I pause the threads to see what is going on, I see an entry for
Worker Thread AMQP Heartbeat Outbound for Connection amqp-0-9://...:5672 System.Threading.WaitHandle.InternalWaitOne() Normal
Here is my Main
:
static void Main(string[] args)
{
var storage = new SqlServerStorage(@"<connection info>");
storage.UseRabbitMq(rabbit =>
{
rabbit.HostName = "<my sever>";
/* ... */
});
JobStorage.Current = storage;
var threads = new[] { FirstWorkerThread, OtherWorkerThread };
threads.ForEach(x => x.Start());
Console.WriteLine("Press <enter> to quit.");
Console.ReadLine();
Console.WriteLine("Stopping the listeners...");
StopEvent.Set();
threads.ForEach(x => x.Join());
Console.WriteLine("fin.");
}
In the absence of UseRabbitMq
, everything is fine. What am I missing?
Levi