コード例 #1
0
def get_notification_transport(conf,
                               url=None,
                               allowed_remote_exmods=None,
                               aliases=None):
    """A factory method for Transport objects for notifications.

    This method should be used for notifications, in case notifications are
    being sent over a different message bus than normal messaging
    functionality; for example, using a different driver, or with different
    access permissions.

    If no transport URL is provided, the URL in the notifications section of
    the config file will be used.  If that URL is also absent, the same
    transport as specified in the messaging section will be used.

    If a transport URL is provided, then this function works exactly the same
    as get_transport.

    :param conf: the user configuration
    :type conf: cfg.ConfigOpts
    :param url: a transport URL
    :type url: str or TransportURL
    :param allowed_remote_exmods: a list of modules which a client using this
                                  transport will deserialize remote exceptions
                                  from
    :type allowed_remote_exmods: list
    :param aliases: A map of transport alias to transport name
    :type aliases: dict
    """
    conf.register_opts(_notifier_opts, group='oslo_messaging_notifications')
    if url is None:
        url = conf.oslo_messaging_notifications.transport_url
    return msg_transport.get_transport(conf, url, allowed_remote_exmods,
                                       aliases)
コード例 #2
0
ファイル: notifier.py プロジェクト: vito0302/oslo.messaging
def get_notification_transport(conf, url=None,
                               allowed_remote_exmods=None, aliases=None):
    if url is None:
        conf.register_opts(_notifier_opts)
        url = conf.notification_transport_url
    return msg_transport.get_transport(conf, url,
                                       allowed_remote_exmods, aliases)
コード例 #3
0
ファイル: notifier.py プロジェクト: ozamiatin/oslo.messaging
def get_notification_transport(conf, url=None,
                               allowed_remote_exmods=None, aliases=None):
    """A factory method for Transport objects for notifications.

    This method should be used for notifications, in case notifications are
    being sent over a different message bus than normal messaging
    functionality; for example, using a different driver, or with different
    access permissions.

    If no transport URL is provided, the URL in the notifications section of
    the config file will be used.  If that URL is also absent, the same
    transport as specified in the messaging section will be used.

    If a transport URL is provided, then this function works exactly the same
    as get_transport.

    :param conf: the user configuration
    :type conf: cfg.ConfigOpts
    :param url: a transport URL
    :type url: str or TransportURL
    :param allowed_remote_exmods: a list of modules which a client using this
                                  transport will deserialize remote exceptions
                                  from
    :type allowed_remote_exmods: list
    :param aliases: A map of transport alias to transport name
    :type aliases: dict
    """
    conf.register_opts(_notifier_opts,
                       group='oslo_messaging_notifications')
    if url is None:
        url = conf.oslo_messaging_notifications.transport_url
    return msg_transport.get_transport(conf, url,
                                       allowed_remote_exmods, aliases)
コード例 #4
0
def get_notification_transport(conf, url=None,
                               allowed_remote_exmods=None, aliases=None):
    conf.register_opts(_notifier_opts,
                       group='oslo_messaging_notifications')
    if url is None:
        url = conf.oslo_messaging_notifications.transport_url
    return msg_transport.get_transport(conf, url,
                                       allowed_remote_exmods, aliases)
コード例 #5
0
ファイル: notifier.py プロジェクト: 571451370/devstack_mitaka
def get_notification_transport(conf, url=None,
                               allowed_remote_exmods=None, aliases=None):
    conf.register_opts(_notifier_opts,
                       group='oslo_messaging_notifications')
    if url is None:
        url = conf.oslo_messaging_notifications.transport_url
    return msg_transport.get_transport(conf, url,
                                       allowed_remote_exmods, aliases)
コード例 #6
0
ファイル: logger.py プロジェクト: SvenDowideit/clearlinux
 def __init__(self, url, publisher_id=None, driver=None,
              topic=None, serializer=None):
     self.notifier = notifier.Notifier(
         transport.get_transport(self.CONF, url),
         publisher_id, driver,
         topic,
         serializer() if serializer else None)
     logging.Handler.__init__(self)
コード例 #7
0
ファイル: test_notifications.py プロジェクト: zzjeric/heat
 def setUp(self):
     super(NotificationTest, self).setUp()
     self.exchange = kombu.Exchange('heat', 'topic', durable=False)
     queue = kombu.Queue(exchange=self.exchange,
                         routing_key='notifications.info',
                         exclusive=True)
     self.conn = kombu.Connection(
         get_url(transport.get_transport(cfg.CONF).conf))
     self.ch = self.conn.channel()
     self.queue = queue(self.ch)
     self.queue.declare()
コード例 #8
0
 def setUp(self):
     super(NotificationTest, self).setUp()
     self.exchange = kombu.Exchange('heat', 'topic', durable=False)
     queue = kombu.Queue(exchange=self.exchange,
                         routing_key='notifications.info',
                         exclusive=True)
     self.conn = kombu.Connection(get_url(
         transport.get_transport(cfg.CONF).conf))
     self.ch = self.conn.channel()
     self.queue = queue(self.ch)
     self.queue.declare()
コード例 #9
0
 def __init__(self,
              url,
              publisher_id=None,
              driver=None,
              topic=None,
              serializer=None):
     self.notifier = notifier.Notifier(
         transport.get_transport(self.CONF, url), publisher_id, driver,
         topic,
         serializer() if serializer else None)
     logging.Handler.__init__(self)
コード例 #10
0
ファイル: messaging.py プロジェクト: wenhulove333/mistral
def start_listener(conf, exchange, topic, endpoints):
    """Starts up a notification listener."""
    trans = transport.get_transport(conf)
    targets = [target.Target(exchange=exchange, topic=topic)]
    pool_name = get_pool_name(exchange)

    notification_listener = listener.get_notification_listener(
        trans,
        targets,
        endpoints,
        executor='threading',
        allow_requeue=False,
        pool=pool_name)
    notification_listener.start()

    return notification_listener
コード例 #11
0
ファイル: messaging.py プロジェクト: openstack/mistral
def start_listener(conf, exchange, topic, endpoints):
    """Starts up a notification listener."""
    trans = transport.get_transport(conf)
    targets = [target.Target(exchange=exchange, topic=topic)]
    pool_name = get_pool_name(exchange)

    notification_listener = listener.get_notification_listener(
        trans,
        targets,
        endpoints,
        executor='threading',
        allow_requeue=False,
        pool=pool_name
    )
    notification_listener.start()

    return notification_listener