static void Main(string[] args)
        {
            AmqpMessagingService messagingService = new AmqpMessagingService();
            IConnection          connection       = messagingService.GetRabbitMqConnection();
            IModel model = connection.CreateModel();

            //messagingService.SetUpQueueForOneMessageDemo(model);

            RunOneWayMessageDemo(model, messagingService);
            Console.ReadKey();
        }
Пример #2
0
        private static void RunOneWayMessageDemo(IModel model, AmqpMessagingService messagingService)
        {
            Console.WriteLine("Enter your message and press Enter. Quit with 'q'.");
            while (true)
            {
                string message = Console.ReadLine();
                if (message.ToLower() == "q")
                {
                    break;
                }

                messagingService.SendOneWayMessage(message, model);
            }
        }
        private static void RunOneWayMessageDemo(IModel model, AmqpMessagingService messagingService)
        {
            Console.WriteLine("Enter your message and press Enter. Quit with 'q'.");
            //while (true)
            //{
            for (int i = 0; i < 50; i++)
            {
                string message = "ICAgICAgICAgICAgICBUZXN0IEludm9pY2UgICAgICAgICAgICAgIA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KUmVmOiAgICAgICAgICAgICAgICAgICAgNzJDSEVaQllNQjM3Qk1LUw0KV2FpdGVyOiAgICAgICAgICAgICAgICAgICAgICAgQm9iIE1hcmxleQ0KVGFibGU6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQyMA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KSXRlbSAgICAgICAgICAgICAgICAgICAgICAgUXR5ICAgIEFtb3VudA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KVE9UQUw6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwwMA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K";
                messagingService.SendOneWayMessage(message, model);
            }
            // if (message.ToLower() == "q") break;

            //}
        }