Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using RabbitMQ.Client;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApplication3{
  9. class Program{
  10. static void Main(string[] args){
  11. var factory = new ConnectionFactory()
  12. {
  13. UserName = "guest",
  14. Password = "guest",
  15. HostName = "localhost",
  16. VirtualHost = "Piotrek"
  17. };
  18. using (var connection = factory.CreateConnection())
  19. using (var channel = connection.CreateModel())
  20. {
  21. channel.QueueDeclare("message_queue", false, false, false, null);
  22.  
  23. var consumer = new MyConsumer(channel);
  24. channel.BasicConsume("message_queue",false, consumer);
  25.  
  26. System.Console.ReadLine();
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement