lib/amqp/queue.rb in amqp-0.8.0 vs lib/amqp/queue.rb in amqp-0.8.1
- old
+ new
@@ -809,10 +809,19 @@
def status(opts = {}, &block)
raise ArgumentError, "AMQP::Queue#status does not make any sense without a block" unless block
shim = Proc.new { |q, declare_ok| block.call(declare_ok.message_count, declare_ok.consumer_count) }
- @channel.once_open { self.declare(true, @durable, @exclusive, @auto_delete, false, nil, &shim) }
+ @channel.once_open do
+ # we do not use self.declare here to avoid caching of @passive since that will cause unexpected side-effects during automatic
+ # recovery process. MK.
+ @connection.send_frame(AMQ::Protocol::Queue::Declare.encode(@channel.id, @name, true, @opts[:durable], @opts[:exclusive], @opts[:auto_delete], false, @opts[:arguments]))
+
+ self.append_callback(:declare, &shim)
+ @channel.queues_awaiting_declare_ok.push(self)
+ end
+
+ self
end
# Boolean check to see if the current queue has already subscribed
# to messages delivery (has default consumer).