private static void startApplication(string key) { try { Bootstrapper.Initialize(key); var shutdownConsumer = new ShutdownConsumer(); Bootstrapper.Register<ShutdownMessage>(shutdownConsumer); shutdownConsumer.Shutdown += HandleShutdownConsumerShutdown; while (!_shutdown) Thread.Sleep(100); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { Bootstrapper.Shutdown(); } }
protected virtual Task OnShutdownConsumer(string consumerTag, ushort errorCode, string shutdownInitiator, string errorMessage) { return(ShutdownConsumer?.Invoke(consumerTag, errorCode, shutdownInitiator, errorMessage)); }