# File lib/mq/queue.rb, line 315
    def subscribe opts = {}, &blk
      @consumer_tag = "#{name}-#{Kernel.rand(999_999_999_999)}"
      @mq.consumers[@consumer_tag] = self

      raise Error, 'already subscribed to the queue' if subscribed?

      @on_msg = blk
      @on_msg_opts = opts
      opts[:nowait] = false if (@on_confirm_subscribe = opts[:confirm])

      @mq.callback{
        @mq.send Protocol::Basic::Consume.new({ :queue => name,
                                                :consumer_tag => @consumer_tag,
                                                :no_ack => !opts[:ack],
                                                :nowait => true }.merge(opts))
      }
      self
    end