using RabbitMQ.Client.Events; using RabbitMQ.Client; using System.Text; var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout); // Определение другого имени очереди var queueName = "myQueue2"; channel.QueueDeclare(queue: queueName, durable: false, exclusive: false, autoDelete: false, arguments: null); channel.QueueBind(queue: queueName, exchange: "logs", routingKey: ""); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { var body = ea.Body.ToArray(); var message = Encoding.UTF8.GetString(body); Console.WriteLine(" [x] Доставлено {0}", message); // Здесь нет задержки, сообщение обрабатывается моментально }; channel.BasicConsume(queue: queueName, autoAck: true, consumer: consumer); Console.WriteLine(" Нажмитие [enter] для выхода."); Console.ReadLine(); }