Skip to content

KAFKA-17164: Enforce 'application.server' <server>:<port> format at config level.#22202

Open
chickenchickenlove wants to merge 2 commits intoapache:trunkfrom
chickenchickenlove:KAFKA-17164
Open

KAFKA-17164: Enforce 'application.server' <server>:<port> format at config level.#22202
chickenchickenlove wants to merge 2 commits intoapache:trunkfrom
chickenchickenlove:KAFKA-17164

Conversation

@chickenchickenlove
Copy link
Copy Markdown
Contributor

Description

This PR implement KIP-1245, which enforces the application.server host:port format during StreamsConfig construction.

Changes

  • Add a ConfigDef.Validator for application.server to fail fast on invalid values in StreamsConfig instead of later in HostInfo.
  • Update an existing StreamsConfigTest case to use a valid application.server value.
  • Add test coverage for valid and invalid application.server values.

@github-actions github-actions Bot added streams triage PRs from the community small Small PRs labels May 4, 2026
@chickenchickenlove
Copy link
Copy Markdown
Contributor Author

Hi, @Nikita-Shupletsov !

It’s been a while since we last spoke.
I opened a PR for KIP-1245, which we discussed earlier!
When you get a chance, please take a look 🙇‍♂️

Copy link
Copy Markdown
Contributor

@nileshkumar3 nileshkumar3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chickenchickenlove thanks for the PR. I have a very minor comment.


final String endPoint = (String) value;

if (endPoint.isEmpty()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant , Utils.isBlank(endPoint) covers this.

@chickenchickenlove
Copy link
Copy Markdown
Contributor Author

@nileshkumar3 Thanks for the time to take a look!
I've addressed it based on your comments.
When you get a chance, please take another look.

Copy link
Copy Markdown
Contributor

@Nikita-Shupletsov Nikita-Shupletsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!
left a few comments


private static final ConfigDef.Validator INSTANCE = new ApplicationServerConfigValidator();

public static ConfigDef.Validator getInstance() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth having it as a singleton?
I checked a few places(e.g. https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/TopicCreationConfig.java#L128) and it looks like we don't really do that anywhere else

import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.utils.Utils;

import static org.apache.kafka.common.utils.Utils.getHost;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: some methods from this class are imported statically, some are called via Utils.method

final Integer port;
try {
port = getPort(endPoint);
} catch (final NumberFormatException e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to catch NumberFormatException? looks like HOST_PORT_PATTERN already checks that it's exclusively digits

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern only says the port looks like digits. Integer.parseInt still errors if that number is too big for a int.

@github-actions github-actions Bot removed the triage PRs from the community label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants