Guest User

Untitled

a guest
Jul 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. rabbitmqctl add_vhost /els
  2. rabbitmqctl delete_user guest
  3. rabbitmqctl add_user gavin gavin
  4. rabbitmqctl authenticate_user gavin gavin
  5. rabbitmqctl set_permissions -p /els gavin "^gavin-.*" ".*" ".*"
  6.  
  7. QueueDeclareOk ok = _channel.QueueDeclare("Ping", durable, exclusive, autoDelete, null);
  8.  
  9. The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=403, text="ACCESS_REFUSED - access to queue 'Ping' in vhost '/els' refused for user 'gavin'", classId=50, methodId=10, cause=
  10.  
  11. //if queue exists or not, this will return 0 if there are no messages in the queue.
  12. QueueDeclareOk ok = _channel.QueueDeclare(queue, durable, exclusive, autoDelete, null);
  13. //returns the number of messages in Ready state in the queue
  14. if (ok.MessageCount > 0)
  15. Console.WriteLine($" ## {queue} has {ok.MessageCount} messages in it's queue. ##");
  16.  
  17. //create a call back consumer
  18. AsyncEventingBasicConsumer consumer = new AsyncEventingBasicConsumer(_channel);
  19.  
  20. //method to bind callback to.
  21. consumer.Received += Consumer_Received;
  22.  
  23. //consume existing and future messages
  24. string consumerTag = _channel.BasicConsume(queue: queue.ToString(),
  25. autoAck: autoAck,
  26. consumer: consumer);
  27.  
  28. //add to dictionary so it can be cancel
  29. _consumerTag.Add(queue, consumerTag);
Add Comment
Please, Sign In to add comment