def receive(host, timeout):
    """
    Print all messages in queue.

    Args:
        host (str): Specified --host.
        timeout (int): How log should script wait for message.
    """
    parameters = settings.get_amqp_settings()[host]

    queues = parameters["queues"]
    queues = dict(map(lambda (x, y): (y, x), queues.items()))  # reverse items
    queue = queues[parameters["out_key"]]

    channel = _get_channel(host, timeout)
    for method_frame, properties, body in channel.consume(queue):
        print json.dumps({
            "method_frame": str(method_frame),
            "properties": str(properties),
            "body": body
        })
        print "-" * 79
        print

        channel.basic_ack(method_frame.delivery_tag)
def receive ( host , timeout ) : parameters = settings . get_amqp_settings ( ) [ host ] queues = parameters [ "queues" ] queues = dict ( map ( lambda ( x , y ) : ( y , x ) , queues . items ( ) ) ) queue = queues [ parameters [ "out_key" ] ] channel = _get_channel ( host , timeout ) for method_frame , properties , body in channel . consume ( queue ) : print json . dumps ( { "method_frame" : str ( method_frame ) , "properties" : str ( properties ) , "body" : body } ) print "-" * 79 print channel . basic_ack ( method_frame . delivery_tag )
Print all messages in queue.

    Args:
        host (str): Specified --host.
        timeout (int): How log should script wait for message.