themachine/core/__init__.py
def consumer(topic, name=None):
    """
    Consumer decorator.
    Registers a handler with a topic, and a queue name.
    Once a message is published into the topic it will be redirected to every
    bound queue and processed once by one of the workers subscribed to it.

    :param topic:   Main topic
    :param name:    Queue name

    :return:        Dictionary
    """
    def decorator(function):
        def wrapper(ch, method, properties, body):
            function(json.loads(body))

        result = channel.queue_declare(
            queue=name.lower() if name else '',
            exclusive=True if not name else False)

        channel.queue_bind(
            exchange=MAIN_EXCHANGE,
            queue=result.method.queue,
            routing_key=topic.lower())

        channel.basic_consume(
            wrapper,
            queue=result.method.queue,
            no_ack=True)

    return decorator

    Consumer decorator.
    Registers a handler with a topic, and a queue name.
    Once a message is published into the topic it will be redirected to every
    bound queue and processed once by one of the workers subscribed to it.

    :param topic:   Main topic
    :param name:    Queue name

    :return:        Dictionary
    
Consumer decorator.
Registers a handler with a topic, and a queue name.
Once a message is published into the topic it will be redirected to every
bound queue and processed once by one of the workers subscribed to it.
Consumer decorator . Registers a handler with a topic and a queue name . Once a message is published into the topic it will be redirected to every bound queue and processed once by one of the workers subscribed to it .
def consumer(topic, name=None):
    def decorator(function):
        def wrapper(ch, method, properties, body):
            function(json.loads(body))
        result = channel.queue_declare(
            queue=name.lower() if name else '',
            exclusive=True if not name else False)
        channel.queue_bind(
            exchange=MAIN_EXCHANGE,
            queue=result.method.queue,
            routing_key=topic.lower())
        channel.basic_consume(
            wrapper,
            queue=result.method.queue,
            no_ack=True)
    return decorator
def consumer ( topic , name = None ) : def decorator ( function ) : def wrapper ( ch , method , properties , body ) : function ( json . loads ( body ) ) result = channel . queue_declare ( queue = name . lower ( ) if name else '' , exclusive = True if not name else False ) channel . queue_bind ( exchange = MAIN_EXCHANGE , queue = result . method . queue , routing_key = topic . lower ( ) ) channel . basic_consume ( wrapper , queue = result . method . queue , no_ack = True ) return decorator
Consumer decorator.
Consumer decorator .
"""
    Consumer decorator.
    Registers a handler with a topic, and a queue name.
    Once a message is published into the topic it will be redirected to every
    bound queue and processed once by one of the workers subscribed to it.

    :param topic:   Main topic
    :param name:    Queue name

    :return:        Dictionary
    """
None
topic
None
name
None