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/08/03 02:06:12 UTC

[GitHub] zhaijack commented on a change in pull request #2219: Cpp client: add PatternMultiTopicsConsumerImpl to support regex subscribe

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

 ##########
 File path: pulsar-client-cpp/lib/BinaryProtoLookupService.cc
 ##########
 @@ -152,4 +152,46 @@ uint64_t BinaryProtoLookupService::newRequestId() {
     Lock lock(mutex_);
     return ++requestIdGenerator_;
 }
+
+Future<Result, NamespaceTopicsPtr> BinaryProtoLookupService::getTopicsOfNamespaceAsync(
+    const NamespaceNamePtr& nsName) {
+    NamespaceTopicsPromisePtr promise = boost::make_shared<Promise<Result, NamespaceTopicsPtr>>();
+    if (!nsName) {
+        promise->setFailed(ResultInvalidTopicName);
+        return promise->getFuture();
+    }
+    std::string namespaceName = nsName->toString();
+    Future<Result, ClientConnectionWeakPtr> future = cnxPool_.getConnectionAsync(serviceUrl_, serviceUrl_);
+    future.addListener(boost::bind(&BinaryProtoLookupService::sendGetTopicsOfNamespaceRequest, this,
+                                   namespaceName, _1, _2, promise));
+    return promise->getFuture();
+}
+
+void BinaryProtoLookupService::sendGetTopicsOfNamespaceRequest(const std::string& nsName, Result result,
+                                                               const ClientConnectionWeakPtr& clientCnx,
+                                                               NamespaceTopicsPromisePtr promise) {
+    if (result != ResultOk) {
+        promise->setFailed(ResultConnectError);
+        return;
+    }
+
+    ClientConnectionPtr conn = clientCnx.lock();
 
 Review comment:
   Yes. lock is for newrequestId and newcommand.

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