示例#1
0
文件: plugin.py 项目: splice/gofer
 def getbroker(self):
     """
     Get the amqp broker for this plugin.  Each plugin can
     connect to a different broker.
     @return: The broker if configured.
     @rtype: L{Broker}
     """
     cfg = self.cfg()
     main = Config()
     broker = Broker(self.geturl())
     broker.cacert = \
         nvl(cfg.messaging.cacert,
         nvl(main.messaging.cacert))
     broker.clientcert = \
         nvl(cfg.messaging.clientcert,
         nvl(main.messaging.clientcert))
     log.info('broker (qpid) configured: %s', broker)
     return broker
示例#2
0
文件: endpoint.py 项目: splice/gofer
 def get(self, url):
     """
     Get the next free session in the pool.
     @param url: A broker url.
     @type url: str
     @return: A free session.
     @rtype: qpid.messaging.Session
     """
     self.__lock()
     try:
         pool = self.__pool(url)
         ssn = self.__pop(pool)
         if ssn is None:
             broker = Broker(url)
             con = broker.connect()
             ssn = con.session()
         pool[1].append(ssn)
         return ssn
     finally:
         self.__unlock()
示例#3
0
 def start(cls):
     url = config.get('messaging', 'url')
     log.info('Using URL: %s', url)
     # broker configuration
     broker = Broker(url)
     broker.cacert = config.get('messaging', 'cacert')
     broker.clientcert = config.get('messaging', 'clientcert')
     log.info('AMQP broker configured')
     # watchdog
     journal = Journal('/var/lib/pulp/journal/watchdog')
     cls.watchdog = WatchDog(url=url, journal=journal)
     cls.watchdog.start()
     log.info('AMQP watchdog started')
     # heartbeat
     cls.heartbeat_listener = HeartbeatListener(url)
     cls.heartbeat_listener.start()
     log.info('AMQP heartbeat listener started')
     # asynchronous reply
     cls.reply_handler = ReplyHandler(url)
     cls.reply_handler.start(cls.watchdog)
     log.info('AMQP reply handler started')
示例#4
0
文件: services.py 项目: bartwo/pulp
 def start(cls):
     url = config.get('messaging', 'url')
     log.info('Using URL: %s', url)
     # broker configuration
     broker = Broker(url)
     broker.cacert = config.get('messaging', 'cacert')
     broker.clientcert = config.get('messaging', 'clientcert')
     log.info('AMQP broker configured')
     # watchdog
     journal = Journal('/var/lib/pulp/journal/watchdog')
     cls.watchdog = WatchDog(url=url, journal=journal)
     cls.watchdog.start()
     log.info('AMQP watchdog started')
     # heartbeat
     cls.heartbeat_listener = HeartbeatListener(url)
     cls.heartbeat_listener.start()
     log.info('AMQP heartbeat listener started')
     # asynchronous reply
     cls.reply_handler = ReplyHandler(url)
     cls.reply_handler.start(cls.watchdog)
     log.info('AMQP reply handler started')
示例#5
0
文件: services.py 项目: ashcrow/pulp
 def init():
     url = config.get('messaging', 'url')
     broker = Broker(url)
     broker.cacert = config.get('messaging', 'cacert')
     broker.clientcert = config.get('messaging', 'clientcert')
     log.info('AMQP broker configured: %s', broker)
示例#6
0
 def __init(cls, url):
     b = Broker(url)
     b.cacert = nvl(cfg.broker.cacert)
     b.clientcert = nvl(cfg.broker.clientcert)