using System.Text; using RabbitMQ.Client; var factory = new ConnectionFactory { HostName = "localhost" }; using var connection = factory.CreateConnection(); using var channel = connection.CreateModel(); channel.ExchangeDeclare(exchange: "report", type: ExchangeType.Fanout); Random rand = new Random(); foreach (var item in Enumerable.Range(0, 1000)) { var message = rand.Next().ToString(); var body = Encoding.UTF8.GetBytes(message); channel.BasicPublish(exchange: "report", routingKey: string.Empty, basicProperties: null, body: body); Console.WriteLine($" [x] Поступило заявление {message}"); await Task.Delay(500); } Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); static string GetMessage(string[] args) { return ((args.Length > 0) ? string.Join(" ", args) : "info: Принято!"); }