Ejemplo n.º 1
0
    def __init__(self, driver, conf, matchmaker, target, poller=None):
        super(ZmqServer, self).__init__()
        self.driver = driver
        self.conf = conf
        self.matchmaker = matchmaker
        self.target = target
        self.poller = poller or zmq_async.get_poller()

        self.router_consumer = zmq_router_consumer.RouterConsumer(
            conf, self.poller, self) \
            if not conf.oslo_messaging_zmq.use_router_proxy else None
        self.dealer_consumer = zmq_dealer_consumer.DealerConsumer(
            conf, self.poller, self) \
            if conf.oslo_messaging_zmq.use_router_proxy else None
        self.sub_consumer = zmq_sub_consumer.SubConsumer(
            conf, self.poller, self) \
            if conf.oslo_messaging_zmq.use_pub_sub else None

        self.consumers = []
        if self.router_consumer is not None:
            self.consumers.append(self.router_consumer)
        if self.dealer_consumer is not None:
            self.consumers.append(self.dealer_consumer)
        if self.sub_consumer is not None:
            self.consumers.append(self.sub_consumer)
Ejemplo n.º 2
0
 def __init__(self, driver, conf, matchmaker=None):
     super(ZmqServer, self).__init__(driver)
     self.matchmaker = matchmaker
     self.poller = zmq_async.get_poller()
     self.rpc_consumer = zmq_router_consumer.RouterConsumer(
         conf, self.poller, self)
     self.notify_consumer = self.rpc_consumer
     self.consumers = [self.rpc_consumer]
Ejemplo n.º 3
0
    def __init__(self, driver, conf, matchmaker=None):
        super(ZmqServer, self).__init__(driver)
        self.matchmaker = matchmaker
        self.poller = zmq_async.get_poller()
        self.rpc_consumer = zmq_router_consumer.RouterConsumerBroker(
            conf, self.poller, self) if conf.direct_over_proxy else \
            zmq_router_consumer.RouterConsumer(
                conf, self.poller, self)
        self.notify_consumer = self.rpc_consumer
        self.sub_consumer = zmq_sub_consumer.SubConsumer(
            conf, self.poller, self) if conf.use_pub_sub else None

        self.consumers = [self.rpc_consumer]
        if self.sub_consumer:
            self.consumers.append(self.sub_consumer)
Ejemplo n.º 4
0
    def __init__(self, driver, conf, matchmaker, target, poller=None):
        super(ZmqServer, self).__init__()
        self.driver = driver
        self.conf = conf
        self.matchmaker = matchmaker
        self.target = target
        self.poller = poller or zmq_async.get_poller()
        self.router_consumer = zmq_router_consumer.RouterConsumer(
            conf, self.poller, self)
        self.sub_consumer = zmq_sub_consumer.SubConsumer(
            conf, self.poller, self) if conf.use_pub_sub else None

        self.consumers = [self.router_consumer]
        if self.sub_consumer:
            self.consumers.append(self.sub_consumer)
Ejemplo n.º 5
0
    def __init__(self, driver, conf, matchmaker=None):
        super(ZmqServer, self).__init__()
        self.driver = driver
        self.conf = conf
        self.matchmaker = matchmaker
        self.poller = zmq_async.get_poller()
        self.router_consumer = zmq_router_consumer.RouterConsumer(
            conf, self.poller, self)
        self.pull_consumer = zmq_pull_consumer.PullConsumer(
            conf, self.poller, self)
        self.sub_consumer = zmq_sub_consumer.SubConsumer(
            conf, self.poller, self) if conf.use_pub_sub else None
        self.notify_consumer = self.sub_consumer if conf.use_pub_sub \
            else self.router_consumer

        self.consumers = [self.router_consumer, self.pull_consumer]
        if self.sub_consumer:
            self.consumers.append(self.sub_consumer)
Ejemplo n.º 6
0
    def __init__(self, driver, conf, matchmaker, target, poller=None):
        super(ZmqServer, self).__init__()
        self.driver = driver
        self.conf = conf
        self.matchmaker = matchmaker
        self.target = target
        self.poller = poller or zmq_async.get_poller()

        LOG.info(
            _LI('[%(host)s] Run server %(target)s'), {
                'host': self.conf.oslo_messaging_zmq.rpc_zmq_host,
                'target': self.target
            })

        if conf.oslo_messaging_zmq.use_router_proxy:
            self.router_consumer = None
            dealer_consumer_cls = \
                zmq_dealer_consumer.DealerConsumerWithAcks \
                if conf.oslo_messaging_zmq.rpc_use_acks else \
                zmq_dealer_consumer.DealerConsumer
            self.dealer_consumer = dealer_consumer_cls(conf, self.poller, self)
        else:
            self.router_consumer = \
                zmq_router_consumer.RouterConsumer(conf, self.poller, self)
            self.dealer_consumer = None

        self.sub_consumer = \
            zmq_sub_consumer.SubConsumer(conf, self.poller, self) \
            if conf.oslo_messaging_zmq.use_pub_sub else None

        self.consumers = []
        if self.router_consumer is not None:
            self.consumers.append(self.router_consumer)
        if self.dealer_consumer is not None:
            self.consumers.append(self.dealer_consumer)
        if self.sub_consumer is not None:
            self.consumers.append(self.sub_consumer)