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
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()
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')
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)
def __init(cls, url): b = Broker(url) b.cacert = nvl(cfg.broker.cacert) b.clientcert = nvl(cfg.broker.clientcert)