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); while (true) { string message = GetMessage(); var body = Encoding.UTF8.GetBytes(message); channel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: body); Console.WriteLine(" [x] Отпралено {0}", message); Thread.Sleep(1000); // Ожидание 1 секунду } } static string GetMessage() { return $"Log: {DateTime.Now}"; }