Esempio n. 1
0
 def _init_listener(self, topic, callback):
     if not topic:
         return
     return messaging.get_notification_listener(
         transport=messaging.get_transport(self._conf),
         targets=[oslo_messaging.Target(topic=topic)],
         endpoints=[PushNotificationsEndpoint(callback)])
Esempio n. 2
0
    def _get_topic_listener(self, conf, topic, callback):
        # Create a listener for each topic
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(topic=topic)]

        return messaging.get_notification_listener(
            transport, targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Esempio n. 3
0
 def __init__(self, conf):
     super(VitrageNotifierService, self).__init__()
     self.conf = conf
     self.notifiers = self.get_notifier_plugins(conf)
     transport = messaging.get_transport(conf)
     target = oslo_messaging.Target(topic=conf.entity_graph.notifier_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target], [VitrageEventEndpoint(self.notifiers)])
Esempio n. 4
0
 def _create_datasources_event_listener(self):
     topic = self.conf.datasources.notification_topic_collector
     transport = messaging.get_transport(self.conf)
     targets = [oslo_messaging.Target(topic=topic)]
     return messaging.get_notification_listener(transport, targets, [
         PushNotificationsEndpoint(self.processor.process_event,
                                   self.processor_lock)
     ])
Esempio n. 5
0
 def __init__(self, worker_id):
     super(MachineLearningService, self).__init__(worker_id)
     self.machine_learning_plugins = self.get_machine_learning_plugins()
     transport = messaging.get_transport()
     target = \
         oslo_m.Target(topic=CONF.machine_learning.machine_learning_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitrageEventEndpoint(self.machine_learning_plugins)])
Esempio n. 6
0
 def __init__(self, conf):
     super(VitrageNotifierService, self).__init__()
     self.conf = conf
     self.notifiers = self.get_notifier_plugins(conf)
     transport = messaging.get_transport(conf)
     target = oslo_messaging.Target(topic=conf.entity_graph.notifier_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitrageEventEndpoint(self.notifiers)])
Esempio n. 7
0
    def _get_topic_listener(self, conf, topic, callback):
        # Create a listener for each topic
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(topic=topic, exchange='nova')]

        return messaging.get_notification_listener(
            transport,
            targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Esempio n. 8
0
    def get_listener(self):
        topics = self._conf.datasources.notification_topics
        exchange = self._conf.datasources.notification_exchange
        transport = messaging.get_transport(self._conf)
        targets = [
            oslo_messaging.Target(exchange=exchange, topic=topic)
            for topic in topics
        ]

        return messaging.get_notification_listener(transport, targets, [self])
Esempio n. 9
0
 def __init__(self, worker_id, conf, db_connection):
     super(PersistorService, self).__init__(worker_id)
     self.conf = conf
     self.db_connection = db_connection
     transport = messaging.get_transport(conf)
     target = \
         oslo_m.Target(topic=conf.persistency.persistor_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitragePersistorEndpoint(self.db_connection)])
Esempio n. 10
0
    def _get_topics_listener(self, conf, callback):
        topics = conf.datasources.notification_topics
        exchange = conf.datasources.notification_exchange
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(exchange=exchange, topic=topic)
                   for topic in topics]

        return messaging.get_notification_listener(
            transport,
            targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Esempio n. 11
0
    def _init_notifier(self, transport, topic, endpoint):
        LOG.debug('Initializing notifier with topic %s', topic)

        self.listeners.append(
            messaging.get_notification_listener(
                transport, [oslo_messaging.Target(topic=topic)], [endpoint]))