'Start an asynchronous consumer that reads from a queue.
This method starts a consumer of type
:class:`~qpid.messaging.endpoints.Receiver` using the
:class:`~qpid.messaging.endpoints.Session` created and referenced by
the :class:`Transport` that reads messages from a queue
specified by name until stopped by a call to :meth:`basic_cancel`.
Messages are available later through a synchronous call to
:meth:`Transport.drain_events`, which will drain from the consumer
started by this method. :meth:`Transport.drain_events` is
synchronous, but the receiving of messages over the network occurs
asynchronously, so it should still perform well.
:meth:`Transport.drain_events` calls the callback provided here with
the Message of type self.Message.
Each consumer is referenced by a consumer_tag, which is provided by
the caller of this method.
This method sets up the callback onto the self.connection object in a
dict keyed by queue name. :meth:`~Transport.drain_events` is
responsible for calling that callback upon message receipt.
All messages that are received are added to the QoS object to be
saved for asynchronous ACKing later after the message has been
handled by the caller of :meth:`~Transport.drain_events`. Messages
can be ACKed after being received through a call to :meth:`basic_ack`.
If no_ack is True, The no_ack flag indicates that the receiver of
the message will not call :meth:`basic_ack` later. Since the
message will not be ACKed later, it is ACKed immediately.
:meth:`basic_consume` transforms the message object type prior to
calling the callback. Initially the message comes in as a
:class:`qpid.messaging.Message`. This method unpacks the payload
of the :class:`qpid.messaging.Message` and creates a new object of
type self.Message.
This method wraps the user delivered callback in a runtime-built
function which provides the type transformation from
:class:`qpid.messaging.Message` to
:class:`~kombu.transport.virtual.Message`, and adds the message to
the associated :class:`QoS` object for asynchronous ACKing
if necessary.
:param queue: The name of the queue to consume messages from
:type queue: str
:param no_ack: If True, then messages will not be saved for ACKing
later, but will be ACKed immediately. If False, then messages
will be saved for ACKing later with a call to :meth:`basic_ack`.
:type no_ack: bool
:param callback: a callable that will be called when messages
arrive on the queue.
:type callback: a callable object
:param consumer_tag: a tag to reference the created consumer by.
This consumer_tag is needed to cancel the consumer.
:type consumer_tag: an immutable object'

def basic_consume(self, queue, no_ack, callback, consumer_tag, **kwargs):

    self._tag_to_queue[consumer_tag] = queue
    def _callback(qpid_message):
        raw_message = qpid_message.content
        message = self.Message(raw_message, channel=self)
        delivery_tag = message.delivery_tag
        self.qos.append(qpid_message, delivery_tag)
        if no_ack:
            self.basic_ack(delivery_tag)
        return callback(message)
    self.connection._callbacks[queue] = _callback
    new_receiver = self.transport.session.receiver(queue)
    new_receiver.capacity = self.qos.prefetch_count
    self._receivers[consumer_tag] = new_receiver
