# File lib/amq/client/async/consumer.rb, line 82 def cancel(nowait = false, &block) @connection.send_frame(Protocol::Basic::Cancel.encode(@channel.id, @consumer_tag, nowait)) self.clear_callbacks(:delivery) self.clear_callbacks(:consume) self.unregister_with_channel self.unregister_with_queue if !nowait self.redefine_callback(:cancel, &block) @channel.consumers_awaiting_cancel_ok.push(self) end self end