ivankelly commented on a change in pull request #1996: Cpp client: add 
multiTopicsConsumer
URL: https://github.com/apache/incubator-pulsar/pull/1996#discussion_r197152025
 
 

 ##########
 File path: pulsar-client-cpp/lib/ClientImpl.cc
 ##########
 @@ -209,6 +211,40 @@ void ClientImpl::handleReaderMetadataLookup(const Result 
result, const LookupDat
     consumers_.push_back(reader->getConsumer());
 }
 
+void ClientImpl::subscribeAsync(const std::vector<std::string>& topics, const 
std::string& consumerName,
+                                const ConsumerConfiguration& conf, 
SubscribeCallback callback) {
+    TopicNamePtr topicNamePtr;
+    {
+        Lock lock(mutex_);
+        if (state_ != Open) {
+            lock.unlock();
+            callback(ResultAlreadyClosed, Consumer());
+            return;
+        } else if (!topics.empty() && !(topicNamePtr = 
MultiTopicsConsumerImpl::topicNamesValid(topics))) {
 
 Review comment:
   This assignment is very hidden. I would move the call to topicNamesValid to 
just after the lock.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to