# File lib/bunny/queue09.rb, line 358 def unsubscribe(opts = {}) # Default consumer_tag from subscription if not passed in consumer_tag = subscription ? subscription.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 @subscription = nil # Return confirmation :unsubscribe_ok end