Esempio n. 1
0
 def __init__(self, conf, session, topic):
     """init a 'topic' publisher.
     """
     exchange_name = rpc_amqp.get_control_exchange(conf)
     super(NotifyPublisher, self).__init__(session,
                                           "%s/%s" % (exchange_name, topic),
                                           {"durable": True})
Esempio n. 2
0
    def __init__(self, conf, channel, topic, callback, tag, name=None,
                 exchange_name=None, **kwargs):
        """Init a 'topic' queue.

        :param channel: the amqp channel to use
        :param topic: the topic to listen on
        :paramtype topic: str
        :param callback: the callback to call when messages are received
        :param tag: a unique ID for the consumer on the channel
        :param name: optional queue name, defaults to topic
        :paramtype name: str

        Other kombu options may be passed as keyword arguments
        """
        # Default options
        options = {'durable': conf.rabbit_durable_queues,
                   'queue_arguments': _get_queue_arguments(conf),
                   'auto_delete': False,
                   'exclusive': False}
        options.update(kwargs)
        exchange_name = exchange_name or rpc_amqp.get_control_exchange(conf)
        exchange = kombu.entity.Exchange(name=exchange_name,
                                         type='topic',
                                         durable=options['durable'],
                                         auto_delete=options['auto_delete'])
        super(TopicConsumer, self).__init__(channel,
                                            callback,
                                            tag,
                                            name=name or topic,
                                            exchange=exchange,
                                            routing_key=topic,
                                            **options)
Esempio n. 3
0
 def __init__(self, conf, session, topic):
     """init a 'topic' publisher.
     """
     exchange_name = rpc_amqp.get_control_exchange(conf)
     super(NotifyPublisher,
           self).__init__(session, "%s/%s" % (exchange_name, topic),
                          {"durable": True})
Esempio n. 4
0
    def __init__(self, conf, session, topic, callback, name=None,
                 exchange_name=None):
        """Init a 'topic' queue.

        :param session: the amqp session to use
        :param topic: is the topic to listen on
        :paramtype topic: str
        :param callback: the callback to call when messages are received
        :param name: optional queue name, defaults to topic
        """

        exchange_name = exchange_name or rpc_amqp.get_control_exchange(conf)
        super(TopicConsumer, self).__init__(session, callback,
                                            "%s/%s" % (exchange_name, topic),
                                            {}, name or topic, {})
Esempio n. 5
0
    def __init__(self, conf, channel, topic, **kwargs):
        """init a 'topic' publisher.

        Kombu options may be passed as keyword args to override defaults
        """
        options = {'durable': conf.rabbit_durable_queues,
                   'auto_delete': False,
                   'exclusive': False}
        options.update(kwargs)
        exchange_name = rpc_amqp.get_control_exchange(conf)
        super(TopicPublisher, self).__init__(channel,
                                             exchange_name,
                                             topic,
                                             type='topic',
                                             **options)
Esempio n. 6
0
    def __init__(self, conf, channel, topic, **kwargs):
        """init a 'topic' publisher.

        Kombu options may be passed as keyword args to override defaults
        """
        options = {
            'durable': conf.rabbit_durable_queues,
            'auto_delete': False,
            'exclusive': False
        }
        options.update(kwargs)
        exchange_name = rpc_amqp.get_control_exchange(conf)
        super(TopicPublisher, self).__init__(channel,
                                             exchange_name,
                                             topic,
                                             type='topic',
                                             **options)
Esempio n. 7
0
    def __init__(self,
                 conf,
                 session,
                 topic,
                 callback,
                 name=None,
                 exchange_name=None):
        """Init a 'topic' queue.

        :param session: the amqp session to use
        :param topic: is the topic to listen on
        :paramtype topic: str
        :param callback: the callback to call when messages are received
        :param name: optional queue name, defaults to topic
        """

        exchange_name = exchange_name or rpc_amqp.get_control_exchange(conf)
        super(TopicConsumer, self).__init__(session, callback,
                                            "%s/%s" % (exchange_name, topic),
                                            {}, name or topic, {})
Esempio n. 8
0
    def __init__(self,
                 conf,
                 channel,
                 topic,
                 callback,
                 tag,
                 name=None,
                 exchange_name=None,
                 **kwargs):
        """Init a 'topic' queue.

        :param channel: the amqp channel to use
        :param topic: the topic to listen on
        :paramtype topic: str
        :param callback: the callback to call when messages are received
        :param tag: a unique ID for the consumer on the channel
        :param name: optional queue name, defaults to topic
        :paramtype name: str

        Other kombu options may be passed as keyword arguments
        """
        # Default options
        options = {
            'durable': conf.rabbit_durable_queues,
            'queue_arguments': _get_queue_arguments(conf),
            'auto_delete': False,
            'exclusive': False
        }
        options.update(kwargs)
        exchange_name = exchange_name or rpc_amqp.get_control_exchange(conf)
        exchange = kombu.entity.Exchange(name=exchange_name,
                                         type='topic',
                                         durable=options['durable'],
                                         auto_delete=options['auto_delete'])
        super(TopicConsumer, self).__init__(channel,
                                            callback,
                                            tag,
                                            name=name or topic,
                                            exchange=exchange,
                                            routing_key=topic,
                                            **options)
Esempio n. 9
0
 def __init__(self, conf, session, topic):
     """init a 'topic' publisher.
     """
     exchange_name = rpc_amqp.get_control_exchange(conf)
     super(TopicPublisher, self).__init__(session,
                                          "%s/%s" % (exchange_name, topic))
Esempio n. 10
0
 def __init__(self, conf, session, topic):
     """init a 'topic' publisher.
     """
     exchange_name = rpc_amqp.get_control_exchange(conf)
     super(TopicPublisher, self).__init__(session,
                                          "%s/%s" % (exchange_name, topic))