def __init__(self, conf, context, matchmaker): wrapper = zmq_sub_consumer.SubscriptionMatchmakerWrapper( conf, matchmaker) super(LocalPublisherProxy, self).__init__(conf, context, wrapper) self.fe_sub = zmq_socket.ZmqSocket(conf, context, zmq.SUB, False) self.fe_sub.setsockopt(zmq.SUBSCRIBE, b'') self.connection_updater = zmq_sub_consumer.SubscriberConnectionUpdater( conf, self.matchmaker, self.fe_sub) self.poller.register(self.fe_sub, self.receive_message) self.publisher = zmq_publisher_proxy.PublisherProxy( conf, matchmaker, sender=zmq_sender.LocalPublisherSender())
def __init__(self, conf, context, matchmaker): super(SingleRouterProxy, self).__init__(conf, context, matchmaker) port = conf.zmq_proxy_opts.frontend_port self.fe_router_socket = zmq_base_proxy.create_socket( conf, context, port, zmq.ROUTER) self.poller.register(self.fe_router_socket, self._receive_message) self.publisher = zmq_publisher_proxy.PublisherProxy(conf, matchmaker) self.router_sender = zmq_sender.CentralRouterSender() self.ack_sender = zmq_sender.CentralAckSender() self._router_updater = self._create_router_updater()
def setUp(self): super(TestPubSub, self).setUp() kwargs = {'use_pub_sub': True, 'rpc_zmq_serialization': self.serialization} self.config(group='oslo_messaging_zmq', **kwargs) self.config(host="127.0.0.1", group="zmq_proxy_opts") self.config(publisher_port="0", group="zmq_proxy_opts") self.publisher = zmq_publisher_proxy.PublisherProxy( self.conf, self.driver.matchmaker) self.driver.matchmaker.register_publisher( (self.publisher.host, "")) self.listeners = [] for i in range(self.LISTENERS_COUNT): self.listeners.append(zmq_common.TestServerListener(self.driver))