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_r205824647
##########
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:
This gets unlocked when it goes out of scope?
----------------------------------------------------------------
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