From e2df954dfeba01262098b0a5823bfd36138f678f Mon Sep 17 00:00:00 2001 From: Rajan Date: Thu, 23 Feb 2017 08:16:34 -0800 Subject: [PATCH] Remove partition-topic redirection as broker sends partition-metadata without redirection (#235) --- pulsar-client-cpp/lib/BinaryProtoLookupService.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pulsar-client-cpp/lib/BinaryProtoLookupService.cc b/pulsar-client-cpp/lib/BinaryProtoLookupService.cc index 61364318960d8..e29882ff1aa4f 100644 --- a/pulsar-client-cpp/lib/BinaryProtoLookupService.cc +++ b/pulsar-client-cpp/lib/BinaryProtoLookupService.cc @@ -117,21 +117,15 @@ namespace pulsar { ClientConnectionPtr conn = clientCnx.lock(); uint64_t requestId = newRequestId(); conn->newPartitionedMetadataLookup(destinationName, requestId, lookupPromise); - lookupPromise->getFuture().addListener(boost::bind(&BinaryProtoLookupService::handleLookup, this, destinationName, _1, _2, clientCnx, promise)); + lookupPromise->getFuture().addListener(boost::bind(&BinaryProtoLookupService::handlePartitionMetadataLookup, this, destinationName, _1, _2, clientCnx, promise)); } void BinaryProtoLookupService::handlePartitionMetadataLookup(const std::string& destinationName, Result result, LookupDataResultPtr data, const ClientConnectionWeakPtr& clientCnx, LookupDataResultPromisePtr promise) { if (data) { - if(data->isRedirect()) { - LOG_DEBUG("PartitionMetadataLookup request is for " << destinationName << " redirected to " << data->getBrokerUrl()); - Future future = cnxPool_.getConnectionAsync(data->getBrokerUrl()); - future.addListener(boost::bind(&BinaryProtoLookupService::sendPartitionMetadataLookupRequest, this, destinationName, _1, _2, promise)); - } else { - LOG_DEBUG("PartitionMetadataLookup response for " << destinationName << ", lookup-broker-url " << data->getBrokerUrl()); - promise->setValue(data); - } + LOG_DEBUG("PartitionMetadataLookup response for " << destinationName << ", lookup-broker-url " << data->getBrokerUrl()); + promise->setValue(data); } else { LOG_DEBUG("PartitionMetadataLookup failed for " << destinationName << ", result " << result); promise->setFailed(result);