# File lib/bunny/queue09.rb, line 295 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::Protocol09::Basic::Cancel.new(:consumer_tag => consumer_tag, :nowait => false)) method = client.next_method client.check_response(method, Qrack::Protocol09::Basic::CancelOk, "Error unsubscribing from queue #{name}") # Reset subscription @default_consumer = nil # Return confirmation :unsubscribe_ok end