Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var factory = new ConnectionFactory
- {
- HostName = "myserver",
- UserName = "testuser",
- Password = "testuserpassword"
- };
- using (var connection = factory.CreateConnection())
- using (var channel = connection.CreateModel())
- {
- channel.QueueDeclare(queue: "LOG",
- durable: false,
- exclusive: false,
- autoDelete: false,
- arguments: null);
- string message = "Hello World!";
- var body = Encoding.UTF8.GetBytes(message);
- channel.BasicPublish(exchange: "",
- routingKey: "LOG",
- basicProperties: null,
- body: body);
- Console.WriteLine(" [x] Sent {0}", message);
- }
- connection = factory.CreateConnection()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement