Ejemplo n.º 1
0
def on_channel_open(channel):
    """Called when our channel has opened"""
    config.set("channel", channel)

    channel.exchange_declare(exchange="rpc", durable=False, auto_delete=True)
    channel.queue_declare(queue="jobs", durable=False, auto_delete=True,
                          callback=on_job_queue_declared)
Ejemplo n.º 2
0
def on_channel_open(channel):
    """Called when our channel has opened"""
    config.set("channel", channel)

    # Fanout exchange + queues for validated orders.
    channel.exchange_declare(exchange="orders", durable=False, type="fanout",
                             auto_delete=True)
    channel.queue_declare(queue="validated", durable=False,
                          auto_delete=True, callback=on_orders_queue_declared)
Ejemplo n.º 3
0
def on_result_queue_declared(frame):
    """
    Called when the RPC results queue has been declared, the generated
    name is in the frame (response from RabbitMQ).
    """
    result_queue = frame.method.queue
    config.set("result_queue", result_queue)
    channel = config.get("channel")
    channel.basic_consume(handle_result, queue=result_queue)
    channel.queue_bind(exchange="rpc", queue=result_queue,
                       routing_key=result_queue)
Ejemplo n.º 4
0
def on_channel_open(channel):
    """Called when our channel has opened"""
    config.set("channel", channel)

    # Preprocessing exchange + queues for non-validated orders.
    channel.exchange_declare(exchange="incoming", durable=False,
                             type="direct", auto_delete=True)
    channel.queue_declare(queue="incoming", durable=False, auto_delete=True,
                          callback=on_incoming_queue_declared)
    channel.queue_declare(queue="decrypted", durable=False, auto_delete=True,
                          callback=on_incoming_queue_declared)
    channel.exchange_declare(exchange="orders", durable=False, type="fanout",
                             auto_delete=True)
Ejemplo n.º 5
0
def on_connected(connection):
    """Called when we are fully connected to RabbitMQ"""
    config.set("connection", connection)
    # Open a channel
    connection.channel(on_channel_open)