lhotari commented on code in PR #24623:
URL: https://github.com/apache/pulsar/pull/24623#discussion_r2306399837


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java:
##########
@@ -446,17 +446,21 @@ private CompletableFuture<Channel> 
connectToAddress(InetSocketAddress logicalAdd
                     .thenCompose(ch ->
                             channelInitializerHandler.initializeClientCnx(ch, 
logicalAddress,
                                     unresolvedPhysicalAddress))
-                    .thenCompose(channel -> 
toCompletableFuture(channel.connect(physicalAddress)));
+                    .thenCompose(channel -> connectToPhysicalAddress(channel, 
physicalAddress));

Review Comment:
   `connectToPhysicalAddress` is a protected method. It's needed for testing 
PIP-430 and doesn't change existing behavior. The test-only 
`org.apache.pulsar.client.api.InjectedClientCnxClientBuilder` class overrides 
`connectToPhysicalAddress` so that it's possible to pass a function to 
customize the connecting to a broker. In the 
AbstractBrokerEntryCacheMultiBrokerTest class, createPulsarClient contains the 
logic to add a delay.
   A similar method would be useful in injecting a failure proxy for the Pulsar 
client to broker connections. It's currently fairly hard to achieve and this PR 
contains another way to do that by using HTTP lookup and modifying the lookup 
response address. By using InjectedClientCnxClientBuilder it would also be 
possible to map the address directly to go through a failure proxy (Pulsar code 
base includes Ipv4Proxy class, Toxiproxy could be used in the future too).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to