merlimat commented on a change in pull request #1124: Support Pulsar proxy from
C++/Python client library
URL: https://github.com/apache/incubator-pulsar/pull/1124#discussion_r164509672
##
File path: pulsar-client-cpp/lib/ConnectionPool.cc
##
@@ -33,36 +33,37 @@ ConnectionPool::ConnectionPool(const ClientConfiguration&
conf, ExecutorServiceP
poolConnections_(poolConnections),
mutex_() {}
-Future
ConnectionPool::getConnectionAsync(const std::string& endpoint) {
+Future ConnectionPool::getConnectionAsync(
+const std::string& logicalAddress, const std::string& physicalAddress) {
boost::unique_lock lock(mutex_);
if (poolConnections_) {
-PoolMap::iterator cnxIt = pool_.find(endpoint);
+PoolMap::iterator cnxIt = pool_.find(logicalAddress);
Review comment:
Yes, though, for efficiency reasons, the proxy maintains a 1-1 relationship
for connections (client->proxy vs proxy->broker). This allows the proxy to
degrade itself to a mere TCP proxy after the initial handshake, just copying
buffers from one side to the other, without deserializing anything.
For this to work, the client needs to be aware that some connections are for
some broker and some are for a different broker. In this case the
"logicalAddress" is the final broker address.
Eg: lookup for topic "t-1" returns "broker-1", with proxy flag turned on.
Client connects to proxy address and adds this connection to pool, marking
this is for "broker-1".
Next time the client will need a connection to "broker-1", it will reuse the
same connection to proxy.
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:
us...@infra.apache.org
With regards,
Apache Git Services