@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { super.channelActive(ctx); log.info("{} Connected to broker", ctx.channel()); String authData = ""; if (authentication.getAuthData().hasDataFromCommand()) { authData = authentication.getAuthData().getCommandData(); } // Send CONNECT command ctx.writeAndFlush(Commands.newConnect(authentication.getAuthMethodName(), authData, getPulsarClientVersion())) .addListener(future -> { if (future.isSuccess()) { if (log.isDebugEnabled()) { log.debug("Complete: {}", future.isSuccess()); } state = State.SentConnectFrame; } else { log.warn("Error during handshake", future.cause()); ctx.close(); } }); }
confBuilder.setConnectTimeout(connectTimeoutInSeconds * 1000); confBuilder.setReadTimeout(readTimeoutInSeconds * 1000); confBuilder.setUserAgent(String.format("Pulsar-Java-v%s", getPulsarClientVersion())); confBuilder.setKeepAliveStrategy(new DefaultKeepAliveStrategy() { @Override