Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using RabbitMQ.Abstraction.Messaging;
- using RabbitMQ.Client;
- using RabbitMQ.Client.Framing;
- namespace ConsoleApp1 {
- class Program {
- static void Main(string[] args) {
- Console.WriteLine($"Start: {DateTime.UtcNow:o}");
- var factory = new ConnectionFactory() {
- AutomaticRecoveryEnabled = true,
- Password = "***",
- UserName = "****",
- VirtualHost = "****",
- HostName = "******"
- };
- using (var connection = factory.CreateConnection()) {
- using (var channel = connection.CreateModel()) {
- for (int x = 0; x < 10000; x++) {
- channel.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null);
- string message = "Hello World!";
- var body = Encoding.UTF8.GetBytes(message);
- {
- channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body);
- }
- }
- }
- }
- Console.WriteLine($"End: {DateTime.UtcNow:o}");
- Console.WriteLine(" Press [enter] to exit.");
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment