Esempio n. 1
0
 def __init__(self, conf, poller, server):
     self.ack_sender = zmq_senders.AckSenderProxy(conf)
     self.reply_sender = zmq_senders.ReplySenderProxy(conf)
     self.messages_cache = zmq_ttl_cache.TTLCache(
         ttl=conf.oslo_messaging_zmq.rpc_message_ttl)
     self.sockets_manager = zmq_sockets_manager.SocketsManager(
         conf, server.matchmaker, zmq.ROUTER, zmq.DEALER)
     self.host = None
     super(DealerConsumer, self).__init__(conf, poller, server, zmq.DEALER)
     self.connection_updater = ConsumerConnectionUpdater(
         conf, self.matchmaker, self.socket)
     LOG.info(_LI("[%s] Run DEALER consumer"), self.host)
Esempio n. 2
0
    def setUp(self):
        super(TestZmqTTLCache, self).setUp()

        def call_count_decorator(unbound_method):
            def wrapper(self, *args, **kwargs):
                wrapper.call_count += 1
                return unbound_method(self, *args, **kwargs)
            wrapper.call_count = 0
            return wrapper

        zmq_ttl_cache.TTLCache._update_cache = \
            call_count_decorator(zmq_ttl_cache.TTLCache._update_cache)

        self.cache = zmq_ttl_cache.TTLCache(ttl=1)

        self.addCleanup(lambda: self.cache.cleanup())
 def __init__(self, conf, poller, server):
     super(DealerConsumerWithAcks, self).__init__(conf, poller, server)
     self.ack_sender = zmq_senders.AckSenderProxy(conf)
     self.messages_cache = zmq_ttl_cache.TTLCache(
         ttl=conf.oslo_messaging_zmq.rpc_message_ttl)