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 02:09:13 UTC

[GitHub] sijie commented on a change in pull request #1269: Issue #1237: support builder for topicsConsumer

sijie commented on a change in pull request #1269: Issue #1237: support builder for topicsConsumer
URL: https://github.com/apache/incubator-pulsar/pull/1269#discussion_r169837431
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/api/ConsumerBuilder.java
 ##########
 @@ -85,6 +86,15 @@
      */
     ConsumerBuilder topic(String topicName);
 
 Review comment:
   Can we just change this to `topic(String... topicNames)` without adding `topics` method?
   
   in `subscribeAsync()`, you can decide whether to subscribe to one topic or multiple topics.
   
   internally in the builder you can maintain a `Set<String>` topics. so this allows you write in a more fluent style.
   
   - subscribe to a topic: `builder.topic("topic-1")`
   - subscribe to multiple topics: `builder.topic("topic-1", "topic-2", "topic-3")`
   - subscribe to multiple topics in a chain way: `builder.topic("topic-1").topic("topic-2").topic("topic-3")`
   
   in `subscribeAsync`: you can check `if (topics.size == 1)` to design what to do.
   
   does this sound better? @merlimat 
   

----------------------------------------------------------------
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