ivankelly commented on a change in pull request #2219: Cpp client: add 
PatternMultiTopicsConsumerImpl to support regex subscribe
URL: https://github.com/apache/incubator-pulsar/pull/2219#discussion_r207461256
 
 

 ##########
 File path: pulsar-client-cpp/lib/ClientConnection.cc
 ##########
 @@ -978,6 +985,51 @@ void ClientConnection::handleIncomingCommand() {
                     break;
                 }
 
+                case BaseCommand::GET_TOPICS_OF_NAMESPACE_RESPONSE: {
+                    const CommandGetTopicsOfNamespaceResponse& response =
+                        incomingCmd_.gettopicsofnamespaceresponse();
+
+                    LOG_DEBUG(cnxString_ << "Received 
GetTopicsOfNamespaceResponse from server. req_id: "
+                                         << response.request_id() << " 
topicsSize" << response.topics_size());
+
+                    Lock lock(mutex_);
+                    PendingGetNamespaceTopicsMap::iterator it =
+                        
pendingGetNamespaceTopicsRequests_.find(response.request_id());
+
+                    if (it != pendingGetNamespaceTopicsRequests_.end()) {
+                        Promise<Result, NamespaceTopicsPtr> getTopicsPromise = 
it->second;
+                        pendingGetNamespaceTopicsRequests_.erase(it);
+                        lock.unlock();
+
+                        int numTopics = response.topics_size();
+                        NamespaceTopicsPtr topicsPtr =
+                            
boost::make_shared<std::vector<std::string>>(numTopics);
+                        topicsPtr->clear();
+
+                        // get all topics
+                        for (int i = 0; i < numTopics; i++) {
+                            // remove partition part
+                            const std::string& topicName = response.topics(i);
+                            int pos = topicName.find("-partition-");
 
 Review comment:
   I mean, there should be library code within pulsar c++ to do this? It seems 
a fairly common operation.

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