1

I'm trying to read messages from a queue using Bunny. I only have read permissions on the RabbitMQ server but it seems the code I'm using tries to create the queue - though I can see the queue already exists with queue_exists?().

There must be a process in Bunny whereby one can simply read messages off an existing queue? Here's the code I'm using

require 'bunny'

class ExampleConsumer < Bunny::Consumer
  def cancelled?
    @cancelled
  end

  def handle_cancellation(_)
    @cancelled = true
  end
end

conn = Bunny.new("amqp://xxx:xxx@xxx", automatic_recovery: false)
conn.start

ch = conn.channel
q = ch.queue("a_queue")
consumer = ExampleConsumer.new(ch, q)

When I execute the above I receive:

/Users/jamessmith/.rvm/gems/ruby-1.9.3-p392/gems/bunny-1.7.1/lib/bunny/channel.rb:1915:in `raise_if_continuation_resulted_in_a_channel_error!': ACCESS_REFUSED - access to queue 'a_queue' in vhost '/' refused for user 'xxx' (Bunny::AccessRefused)
James Smith
  • 501
  • 5
  • 13

1 Answers1

0

in most RMQ configurations I've seen, the consumer will have permissions to create the queue that they need.

If you must have your permissions set up so that you can't create the queue from your consumer, I'd suggest opening an issue ticket with the Bunny gem. it doesn't look like that is supported

Derick Bailey
  • 72,004
  • 22
  • 206
  • 219