/** * Creates TensorFlow cluster gateway. * * @param topicName Topic name. * @return TensorFlow cluster gateway. */ private TensorFlowClusterGateway createTensorFlowClusterGateway(String topicName) { TensorFlowClusterGateway gateway = new TensorFlowClusterGateway(subscriber -> { ignite.message().stopLocalListen(topicName, subscriber); log.info("Stop listen to cluster gateway [topicName=" + topicName + "]"); }); ignite.message().localListen(topicName, gateway); log.info("Start listen to cluster gateway [topicName=" + topicName + "]"); return gateway; } }
/** * Single server test with local listener. * @throws Exception If failed. */ private void localListenerInternal() throws Exception { int messages = MSGS; Ignite ignite = grid(SERVER_NODE_IDX); LATCH = new CountDownLatch(messages); ClusterGroup grp = grid(SERVER_NODE_IDX).cluster().forLocal(); MessageListener c = new MessageListener(); try { ignite.message(grp).localListen("localListenerTopic", c); for (int i = 0; i < messages; i++) ignite.message(grp).send("localListenerTopic", value(i)); assertTrue(LATCH.await(10, TimeUnit.SECONDS)); } finally { ignite.message().stopLocalListen("localListenerTopic", c); } }
assertEquals(1, msgCnt3.get()); ignite1.message().stopLocalListen(topic2, lsnr2); assertEquals(2, msgCnt3.get()); ignite1.message().stopLocalListen(topic2, lsnr1); // Try to use wrong topic for lsnr1 removing. assertEquals(3, msgCnt3.get()); ignite1.message().stopLocalListen(topic1, lsnr1); ignite1.message().stopLocalListen(topic3, lsnr3);
messaging.stopLocalListen(topic, filter);
@Override protected void doStop() throws Exception { super.doStop(); messaging.stopLocalListen(endpoint.getTopic(), predicate); LOG.info("Stopped Ignite Messaging consumer for topic {}.", endpoint.getTopic()); }
messaging.stopLocalListen(topic, filter);