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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to