[GitHub] [pulsar] sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking
sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking URL: https://github.com/apache/pulsar/pull/5716#discussion_r350956612 ## File path: pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java ## @@ -62,4 +71,43 @@ public void testGetStats() throws Exception { impl.getStats(); } +@Test +public void multiTopicsInDifferentNameSpace() throws PulsarClientException { +List topics = new ArrayList<>(); +topics.add("persistent://public/default/MultiTopics1"); +topics.add("persistent://public/test-multi/MultiTopics2"); +topics.add("persistent://public/test-multi/MultiTopics3"); +ClientConfigurationData conf = new ClientConfigurationData(); +conf.setServiceUrl("pulsar://localhost:6650"); +conf.setStatsIntervalSeconds(100); + +PulsarClientImpl clientImpl = new PulsarClientImpl(conf); + +Consumer consumer = clientImpl.newConsumer().topics(topics) +.subscriptionName("multiTopicSubscription") +.messageListener(new MessageListener() { +@Override +public void received(Consumer consumer, Message msg) { + if("producer".equals(msg.getProducerName()) || "producer1".equals(msg.getProducerName())){ + String message = new String(msg.getData()); + assertTrue(message.contains("MultiTopics")); Review comment: The assertion is done in another thread. The code might never run since you close consumer immediately after producers sent the records. Please change the logic to use `#receive`. Add the logic to receive messages and verify them after line 109. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking
sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking URL: https://github.com/apache/pulsar/pull/5716#discussion_r351007391 ## File path: pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java ## @@ -62,4 +71,43 @@ public void testGetStats() throws Exception { impl.getStats(); } +@Test +public void multiTopicsInDifferentNameSpace() throws PulsarClientException { +List topics = new ArrayList<>(); +topics.add("persistent://public/default/MultiTopics1"); +topics.add("persistent://public/test-multi/MultiTopics2"); +topics.add("persistent://public/test-multi/MultiTopics3"); +ClientConfigurationData conf = new ClientConfigurationData(); +conf.setServiceUrl("pulsar://localhost:6650"); +conf.setStatsIntervalSeconds(100); + +PulsarClientImpl clientImpl = new PulsarClientImpl(conf); + +Consumer consumer = clientImpl.newConsumer().topics(topics) +.subscriptionName("multiTopicSubscription") +.messageListener(new MessageListener() { +@Override +public void received(Consumer consumer, Message msg) { + if("producer".equals(msg.getProducerName()) || "producer1".equals(msg.getProducerName())){ + String message = new String(msg.getData()); + assertTrue(message.contains("MultiTopics")); Review comment: The assertion is done in another thread. The code might never run since you close consumer immediately after producers sent the records. Please change the logic to use `#receive`. Add the logic to receive messages and verify them after line 109. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking
sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking URL: https://github.com/apache/pulsar/pull/5716#discussion_r349935076 ## File path: pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java ## @@ -62,4 +69,44 @@ public void testGetStats() throws Exception { impl.getStats(); } +@Test +public void multiTopicsInDifferentNameSpace() throws PulsarClientException { +List topics = new ArrayList<>(); +topics.add("persistent://public/default/MultiTopics1"); +topics.add("persistent://public/test-multi/MultiTopics2"); +topics.add("persistent://public/test-multi/MultiTopics3"); +ClientConfigurationData conf = new ClientConfigurationData(); +conf.setServiceUrl("pulsar://localhost:6650"); +conf.setStatsIntervalSeconds(100); + +ThreadFactory threadFactory = new DefaultThreadFactory("client-test-multi", Thread.currentThread().isDaemon()); +EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); +ExecutorService listenerExecutor = Executors.newSingleThreadScheduledExecutor(threadFactory); Review comment: who is using `listenerExecutor`? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking
sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking URL: https://github.com/apache/pulsar/pull/5716#discussion_r349935108 ## File path: pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java ## @@ -62,4 +69,44 @@ public void testGetStats() throws Exception { impl.getStats(); } +@Test +public void multiTopicsInDifferentNameSpace() throws PulsarClientException { +List topics = new ArrayList<>(); +topics.add("persistent://public/default/MultiTopics1"); +topics.add("persistent://public/test-multi/MultiTopics2"); +topics.add("persistent://public/test-multi/MultiTopics3"); +ClientConfigurationData conf = new ClientConfigurationData(); +conf.setServiceUrl("pulsar://localhost:6650"); +conf.setStatsIntervalSeconds(100); + +ThreadFactory threadFactory = new DefaultThreadFactory("client-test-multi", Thread.currentThread().isDaemon()); +EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); +ExecutorService listenerExecutor = Executors.newSingleThreadScheduledExecutor(threadFactory); +PulsarClientImpl clientImpl = new PulsarClientImpl(conf, eventLoopGroup); +ConsumerConfigurationData consumerConfData = new ConsumerConfigurationData(); +consumerConfData.setTopicNames(Sets.newHashSet(topics)); + +Consumer consumer = clientImpl.newConsumer().topics(topics) +.subscriptionName("multiTopicSubscription") +.messageListener(new MessageListener() { +@Override +public void received(Consumer consumer, Message msg) { +System.out.println(" Message received:" + new String(msg.getData())); +} +}) +.subscribe(); + +Producer producer = clientImpl.newProducer(Schema.STRING) +.topic("persistent://public/default/MultiTopics1") +.create(); +Producer producer1 = clientImpl.newProducer(Schema.STRING) +.topic("persistent://public/test-multi/MultiTopics2") +.create(); +producer.send("default/MultiTopics1-Message1"); +producer1.send("test-multi/MultiTopics2-Message1"); +producer.closeAsync(); Review comment: you need add the logic to verify you receive the messages that are produced by producer and producer1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking
sijie commented on a change in pull request #5716: [Issues 5709]remove the namespace checking URL: https://github.com/apache/pulsar/pull/5716#discussion_r349935066 ## File path: pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java ## @@ -62,4 +69,44 @@ public void testGetStats() throws Exception { impl.getStats(); } +@Test +public void multiTopicsInDifferentNameSpace() throws PulsarClientException { +List topics = new ArrayList<>(); +topics.add("persistent://public/default/MultiTopics1"); +topics.add("persistent://public/test-multi/MultiTopics2"); +topics.add("persistent://public/test-multi/MultiTopics3"); +ClientConfigurationData conf = new ClientConfigurationData(); +conf.setServiceUrl("pulsar://localhost:6650"); +conf.setStatsIntervalSeconds(100); + +ThreadFactory threadFactory = new DefaultThreadFactory("client-test-multi", Thread.currentThread().isDaemon()); +EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); Review comment: out of curiosity, why do you create an external event loop? If you are using an external event loop, it is a good practice to shutdown the event loop at the end of the test. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services