zhaijack commented on a change in pull request #1269: Issue #1237: support builder for topicsConsumer URL: https://github.com/apache/incubator-pulsar/pull/1269#discussion_r169826798
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java ########## @@ -77,17 +79,25 @@ public Consumer subscribe() throws PulsarClientException { @Override public CompletableFuture<Consumer> subscribeAsync() { - if (topicName == null) { + if (topicName == null && topicNames == null) { return FutureUtil - .failedFuture(new IllegalArgumentException("Topic name must be set on the producer builder")); + .failedFuture(new IllegalArgumentException("Topic name must be set on the consumer builder")); + } + if (topicName != null && topicNames != null) { + return FutureUtil + .failedFuture(new IllegalArgumentException("Should set either topicName or topicNames not both on the consumer builder")); } if (subscriptionName == null) { return FutureUtil.failedFuture( - new IllegalArgumentException("Subscription name must be set on the producer builder")); + new IllegalArgumentException("Subscription name must be set on the consumer builder")); } - return client.subscribeAsync(topicName, subscriptionName, conf); + if (topicName != null) { + return client.subscribeAsync(topicName, subscriptionName, conf); + } else { + return client.subscribeAsync(topicNames, subscriptionName, conf); Review comment: Oh, Thanks, I see. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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