eolivelli commented on a change in pull request #14078:
URL: https://github.com/apache/pulsar/pull/14078#discussion_r795659095



##########
File path: 
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/DirectProxyHandler.java
##########
@@ -316,6 +322,7 @@ protected void messageReceived() {
 
         @Override
         protected void handleConnected(CommandConnected connected) {
+            checkArgument(state == BackendState.Init, "Unexpected state %s. 
BackendState.Init was expected.", state);

Review comment:
       should we close the channel ?
   other wise we will let an Unchecked Exception escape.

##########
File path: 
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
##########
@@ -245,6 +250,16 @@ private synchronized void completeConnect(AuthData 
clientData) throws PulsarClie
         LOG.info("[{}] complete connection, init proxy handler. authenticated 
with {} role {}, hasProxyToBrokerUrl: {}",
             remoteAddress, authMethod, clientAuthRole, hasProxyToBrokerUrl);
         if (hasProxyToBrokerUrl) {
+            // Optimize proxy connection to fail-fast if the target broker 
isn't active
+            // Pulsar client will retry connecting after a back off timeout
+            if (service.getConfiguration().isCheckActiveBrokers()
+                    && !isBrokerActive(proxyToBrokerUrl)) {
+                ctx()
+                        .writeAndFlush(
+                                Commands.newError(-1, 
ServerError.ServiceNotReady, "Target broker isn't available."))

Review comment:
       what about reporting the address of the broker here ?




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