コード例 #1
0
ファイル: impl_qpid.py プロジェクト: DJohnstone/trove
 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})
コード例 #2
0
ファイル: impl_qpid.py プロジェクト: tanisdeluna/reddwarf
 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})
コード例 #3
0
ファイル: impl_kombu.py プロジェクト: imsplitbit/reddwarf
    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
        )
コード例 #4
0
ファイル: impl_kombu.py プロジェクト: imsplitbit/reddwarf
    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)
コード例 #5
0
ファイル: impl_qpid.py プロジェクト: DJohnstone/trove
    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, {})
コード例 #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)
コード例 #7
0
ファイル: impl_qpid.py プロジェクト: tanisdeluna/reddwarf
    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, {})
コード例 #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)
コード例 #9
0
ファイル: impl_qpid.py プロジェクト: DJohnstone/trove
 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))
コード例 #10
0
ファイル: impl_qpid.py プロジェクト: tanisdeluna/reddwarf
 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))