'Handle and call callbacks for all ready Transport messages.
Drains all events that are ready from all
:class:`~qpid.messaging.endpoints.Receiver` that are asynchronously
fetching messages.
For each drained message, the message is called to the appropriate
callback. Callbacks are organized by queue name.
:param connection: The :class:`~kombu.transport.qpid.Connection` that
contains the callbacks, indexed by queue name, which will be called
by this method.
:type connection: kombu.transport.qpid.Connection
:keyword timeout: The timeout that limits how long this method will
run for. The timeout could interrupt a blocking read that is
waiting for a new message, or cause this method to return before
all messages are drained. Defaults to 0.
:type timeout: int'

def drain_events(self, connection, timeout=0, **kwargs):

    start_time = monotonic()
    elapsed_time = (-1)
    while (elapsed_time < timeout):
        try:
            receiver = self.session.next_receiver(timeout=timeout)
            message = receiver.fetch()
            queue = receiver.source
        except QpidEmpty:
            raise socket.timeout()
        else:
            connection._callbacks[queue](message)
        elapsed_time = (monotonic() - start_time)
    raise socket.timeout()
