Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rabbitmqctl add_vhost /els
- rabbitmqctl delete_user guest
- rabbitmqctl add_user gavin gavin
- rabbitmqctl authenticate_user gavin gavin
- rabbitmqctl set_permissions -p /els gavin "^gavin-.*" ".*" ".*"
- QueueDeclareOk ok = _channel.QueueDeclare("Ping", durable, exclusive, autoDelete, null);
- 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=
- //if queue exists or not, this will return 0 if there are no messages in the queue.
- QueueDeclareOk ok = _channel.QueueDeclare(queue, durable, exclusive, autoDelete, null);
- //returns the number of messages in Ready state in the queue
- if (ok.MessageCount > 0)
- Console.WriteLine($" ## {queue} has {ok.MessageCount} messages in it's queue. ##");
- //create a call back consumer
- AsyncEventingBasicConsumer consumer = new AsyncEventingBasicConsumer(_channel);
- //method to bind callback to.
- consumer.Received += Consumer_Received;
- //consume existing and future messages
- string consumerTag = _channel.BasicConsume(queue: queue.ToString(),
- autoAck: autoAck,
- consumer: consumer);
- //add to dictionary so it can be cancel
- _consumerTag.Add(queue, consumerTag);
Add Comment
Please, Sign In to add comment