# File lib/bunny/queue.rb, line 298 def unsubscribe(opts = {}) # Default consumer_tag from subscription if not passed in consumer_tag = @default_consumer ? @default_consumer.consumer_tag : opts[:consumer_tag] # Must have consumer tag to tell server what to unsubscribe raise Bunny::UnsubscribeError, "No consumer tag received" if !consumer_tag # Cancel consumer client.send_frame(Qrack::Protocol::Basic::Cancel.new(:consumer_tag => consumer_tag, :nowait => false)) # Reset subscription @default_consumer = nil method = client.next_method client.check_response(method, Qrack::Protocol::Basic::CancelOk, "Error unsubscribing from queue #{name}, got #{method.class}") # Return confirmation :unsubscribe_ok end