From commits-return-12211-archive-asf-public=cust-asf.ponee.io@pulsar.incubator.apache.org Thu Aug 2 00:21:25 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 71EB518077F for ; Thu, 2 Aug 2018 00:21:24 +0200 (CEST) Received: (qmail 64878 invoked by uid 500); 1 Aug 2018 22:21:23 -0000 Mailing-List: contact commits-help@pulsar.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.incubator.apache.org Delivered-To: mailing list commits@pulsar.incubator.apache.org Received: (qmail 64628 invoked by uid 99); 1 Aug 2018 22:21:23 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2018 22:21:23 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] ivankelly commented on a change in pull request #2219: Cpp client: add PatternMultiTopicsConsumerImpl to support regex subscribe Message-ID: <153316208293.10210.6850067905377185061.gitbox@gitbox.apache.org> Date: Wed, 01 Aug 2018 22:21:22 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r205826122 ########## 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 getTopicsPromise = it->second; + pendingGetNamespaceTopicsRequests_.erase(it); + lock.unlock(); + + int numTopics = response.topics_size(); + NamespaceTopicsPtr topicsPtr = + boost::make_shared>(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: There should already be library code to do this? ---------------------------------------------------------------- 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