Method: Bunny::Queue#initialize
- Defined in:
- lib/bunny/queue.rb
#initialize(channel, name = AMQ::Protocol::EMPTY_STRING, opts = {}) ⇒ Queue
Returns a new instance of Queue.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/bunny/queue.rb', line 54 def initialize(channel, name = AMQ::Protocol::EMPTY_STRING, opts = {}) # old Bunny versions pass a connection here. In that case, # we just use default channel from it. MK. @channel = channel @name = name = self.class.(name, opts) @durable = [:durable] @exclusive = [:exclusive] @server_named = @name.empty? @auto_delete = [:auto_delete] @type = [:type] @arguments = if @type and !@type.empty? then ([:arguments] || {}).merge({XArgs::QUEUE_TYPE => @type}) else [:arguments] end verify_type!(@arguments) # reassigns updated and verified arguments because Bunny::Channel#declare_queue # accepts a map of options [:arguments] = @arguments @bindings = Array.new @default_consumer = nil declare! unless opts[:no_declare] # for basic.deliver dispatch and such @channel.register_queue(self) # for topology recovery @channel.record_queue(self) end |