Ejemplo n.º 1
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        // ReSharper disable once UnusedParameter.Local
        private static void Main(string[] args)
        {
            LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter();

            Params = ConsumerParams.ReadFromAppSettings();

            Console.WriteLine("Starting consumer [{0}]...", Params.Endpoint);
            using (IBus bus = new BusFactory().Create(ConfigureBus, false))
            {
                bus.Start(false);

                var t = new Timer(10000);
                // ReSharper disable once AccessToDisposedClosure
                t.Elapsed += (sender, eventArgs) => ((IBusAdvanced)bus).Panic();

                if (Params.Misbehave)
                {
                    t.Start();
                }

                Console.ReadKey(true);

                t.Close();
                Console.WriteLine("Shutting down consumer [{0}]...", Params.Endpoint);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        // ReSharper disable once UnusedParameter.Local
        private static void Main(string[] args)
        {
            LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter();

            Params = ConsumerParams.ReadFromAppSettings();

            Console.WriteLine("Starting consumer [{0}]...", Params.Endpoint);
            using (IBus bus = new BusFactory().Create(ConfigureBus, false))
            {
                bus.Start(false);

                var t = new Timer(10000);
                // ReSharper disable once AccessToDisposedClosure
                t.Elapsed += (sender, eventArgs) => ((IBusAdvanced)bus).Panic();

                if (Params.Misbehave)
                {
                    t.Start();
                }

                Console.ReadKey(true);

                t.Close();
                Console.WriteLine("Shutting down consumer [{0}]...", Params.Endpoint);
            }
        }