Пример #1
0
        public void Dispose_without_start_is_no_op()
        {
            // TODO: Why does this test take 10 times longer than the others in this class?
            _sut.Dispose();

            Assert.Contains(_logger.LogEntries, e => e.EventId.Id == 103 && e.LogLevel == LogLevel.Trace);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // consumer

            var consumerService = new RabbitMqConsumerService(GetBrokerConfigConsumers());

            consumerService.ReceiveMessage          += ReceiveMessage;
            consumerService.ShutdownConsumer        += ShutdownConsumer;
            consumerService.ReceiveMessageError     += ReceiveMessageError;
            consumerService.MaxChannelsPerConnection = 100;
            consumerService.ServiceDescription       = "test consumer service";

            try
            {
                consumerService.StartConsumers("my consumer");
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error starting consumers: {e.Message}");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                Environment.Exit(-1);
            }


            // sender

            var senderService = new RabbitMqSenderService(GetBrokerConfigSender());

            senderService.Send("my message");

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();

            consumerService.Dispose();
        }