You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/02/22 00:39:42 UTC
[GitHub] merlimat commented on a change in pull request #1269: Issue #1237: support builder for topicsConsumer
merlimat commented on a change in pull request #1269: Issue #1237: support builder for topicsConsumer
URL: https://github.com/apache/incubator-pulsar/pull/1269#discussion_r169824643
##########
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:
@zhaijack I think we should remove the `subscribeAsync(List<String> topics)` method because all the `subscribe()` methods are deprecated in 2.0
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services