lib/amqp/consumer.rb in amqp-1.4.1 vs lib/amqp/consumer.rb in amqp-1.4.2

- old
+ new

@@ -75,12 +75,14 @@ # @return [AMQP::Consumer] self def consume(nowait = false, &block) @channel.once_open do @queue.once_declared do @connection.send_frame(AMQ::Protocol::Basic::Consume.encode(@channel.id, @queue.name, @consumer_tag, @no_local, @no_ack, @exclusive, nowait, @arguments)) - self.redefine_callback(:consume, &block) - @channel.consumers_awaiting_consume_ok.push(self) + if !nowait + self.redefine_callback(:consume, &block) + @channel.consumers_awaiting_consume_ok.push(self) + end self end end