Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. var factory = new ConnectionFactory
  2. {
  3. HostName = "myserver",
  4. UserName = "testuser",
  5. Password = "testuserpassword"
  6. };
  7.  
  8. using (var connection = factory.CreateConnection())
  9. using (var channel = connection.CreateModel())
  10. {
  11. channel.QueueDeclare(queue: "LOG",
  12. durable: false,
  13. exclusive: false,
  14. autoDelete: false,
  15. arguments: null);
  16.  
  17. string message = "Hello World!";
  18. var body = Encoding.UTF8.GetBytes(message);
  19.  
  20. channel.BasicPublish(exchange: "",
  21. routingKey: "LOG",
  22. basicProperties: null,
  23. body: body);
  24. Console.WriteLine(" [x] Sent {0}", message);
  25. }
  26.  
  27. connection = factory.CreateConnection()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement