kirktrue commented on code in PR #14359:
URL: https://github.com/apache/kafka/pull/14359#discussion_r1323645279
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java:
##########
@@ -63,6 +68,31 @@ public NetworkClientDelegate(
this.unsentRequests = new ArrayDeque<>();
this.requestTimeoutMs =
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG);
this.retryBackoffMs =
config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG);
+ this.tryConnectNodes = new HashSet<>();
+ }
+
+ @Override
+ public boolean isUnavailable(Node node) {
+ return NetworkClientUtils.isUnavailable(client, node, time);
+ }
+
+ @Override
+ public void maybeThrowAuthFailure(Node node) {
+ NetworkClientUtils.maybeThrowAuthFailure(client, node);
+ }
+
+ @Override
+ public void tryConnect(Node node) {
+ tryConnectNodes.add(node);
Review Comment:
It is now 😉
Unlike the `ConsumerNetworkClient`, we don't attempt to connect to the node
immediately. We queue up the set of `Node`s to which to connect and call them
from the background thread shortly before calling `poll`. The existing
implementation would attempt to connect immediately, and potentially more than
once in some cases.
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java:
##########
@@ -63,6 +68,31 @@ public NetworkClientDelegate(
this.unsentRequests = new ArrayDeque<>();
this.requestTimeoutMs =
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG);
this.retryBackoffMs =
config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG);
+ this.tryConnectNodes = new HashSet<>();
+ }
+
+ @Override
+ public boolean isUnavailable(Node node) {
+ return NetworkClientUtils.isUnavailable(client, node, time);
+ }
+
+ @Override
+ public void maybeThrowAuthFailure(Node node) {
+ NetworkClientUtils.maybeThrowAuthFailure(client, node);
+ }
+
+ @Override
+ public void tryConnect(Node node) {
+ tryConnectNodes.add(node);
Review Comment:
It is now 😉
Unlike the `ConsumerNetworkClient`, we don't attempt to connect to the node
immediately. We queue up the set of `Node`s to which to connect and call them
from the background thread shortly before calling `poll`. The existing
implementation would attempt to connect immediately, and potentially more than
once in some cases.
--
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]