-
Notifications
You must be signed in to change notification settings - Fork 14.7k
MINOR: migrate listenerListToEndPoints from CoreUtils to AbstractKafkaConfig #20567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
a2fe028
to
6c1d6a3
Compare
if (distinctListenerNames != endPoints.size()) { | ||
throw new IllegalArgumentException("Each listener must have a different name, listeners: " + listeners); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can return early if requireDistinctPorts
is false
, right? for example:
private static void validate(List<Endpoint> endPoints, List<String> listeners, boolean requireDistinctPorts) {
long distinct = endPoints.stream().map(Endpoint::listener).distinct().count();
if (distinct != endPoints.size()) {
throw new IllegalArgumentException("Each listener must have a different name, listeners: " + listeners);
}
if (!requireDistinctPorts) return;
...
List<Endpoint> duplicatesWithIpHosts = partitionedByValidIp.get(true); | ||
List<Endpoint> duplicatesWithoutIpHosts = partitionedByValidIp.get(false); | ||
|
||
if (requireDistinctPorts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requireDistinctPorts
is always false
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks.
assertEquals(listenerListToEndPoints(util.List.of("PLAINTEXT://:9092")).asScala, conf.listeners) | ||
assertNull(conf.listeners.find(_.securityProtocol == SecurityProtocol.PLAINTEXT).get.host) | ||
assertEquals(conf.effectiveAdvertisedBrokerListeners, listenerListToEndPoints(util.List.of("PLAINTEXT://:9092"))) | ||
assertEquals(conf.effectiveAdvertisedBrokerListeners, listenerListToEndPoints(util.List.of("PLAINTEXT://:9092")).asScala) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be in reverse order.
assertEquals(conf.effectiveAdvertisedBrokerListeners, listenerListToEndPoints(util.List.of("PLAINTEXT://:9092")).asScala) | |
assertEquals(listenerListToEndPoints(util.List.of("PLAINTEXT://:9092")).asScala, conf.effectiveAdvertisedBrokerListeners)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks!
Migrate listenerListToEndPoints from CoreUtils to AbstractKafkaConfig