示例#1
0
    def run(self):
        transport = messaging.get_transport(self.conf)
        if transport:
            topic = "controller"
            target = music_messaging.Target(topic=topic)
            endpoints = [
                rpc.ControllerRPCEndpoint(self.conf, self.Plan),
            ]
            flush = not self.conf.controller.concurrent
            kwargs = {
                'transport': transport,
                'target': target,
                'endpoints': endpoints,
                'flush': flush,
            }
            svcmgr = cotyledon.ServiceManager()
            svcmgr.add(music_messaging.RPCService,
                       workers=self.conf.controller.workers,
                       args=(self.conf, ),
                       kwargs=kwargs)

            kwargs = {'plan_class': self.Plan, 'order_locks': self.OrderLock}
            svcmgr.add(translator_svc.TranslatorService,
                       workers=self.conf.controller.workers,
                       args=(self.conf, ),
                       kwargs=kwargs)
            svcmgr.run()
示例#2
0
 def setup_rpc(self, conf, topic):
     """Set up the RPC Client"""
     # TODO(jdandrea): Put this pattern inside music_messaging?
     transport = messaging.get_transport(conf=conf)
     target = music_messaging.Target(topic=topic)
     client = music_messaging.RPCClient(conf=conf,
                                        transport=transport,
                                        target=target)
     return client
示例#3
0
文件: hooks.py 项目: onap/optf-has
 def __init__(self, conf):
     super(MessagingHook, self).__init__()
     topic = "controller"
     transport = messaging.get_transport(conf=conf)
     target = music_messaging.Target(topic=topic)
     self.controller = \
         music_messaging.RPCClient(conf=conf,
                                   transport=transport,
                                   target=target)
示例#4
0
 def run(self):
     transport = messaging.get_transport(self.conf)
     if transport:
         topic = "data"
         target = music_messaging.Target(topic=topic)
         endpoints = [
             DataEndpoint(self.ip_ext_manager, self.vc_ext_manager,
                          self.sc_ext_manager),
         ]
         flush = not self.conf.data.concurrent
         kwargs = {
             'transport': transport,
             'target': target,
             'endpoints': endpoints,
             'flush': flush,
         }
         svcmgr = cotyledon.ServiceManager()
         svcmgr.add(music_messaging.RPCService,
                    workers=self.conf.data.workers,
                    args=(self.conf, ),
                    kwargs=kwargs)
         svcmgr.run()