Skip to content
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

[FLINK-32893][Connectors/Kafka] Allow the clientid to be fully configurable #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public class KafkaSourceOptions {
.noDefaultValue()
.withDescription("The prefix to use for the Kafka consumers.");

public static final ConfigOption<String> COMPLETE_CLIENT_ID =
ConfigOptions.key("client.id.complete")
Copy link

Choose a reason for hiding this comment

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

Suggested change
ConfigOptions.key("client.id.complete")
ConfigOptions.key("client.id")

shall we just use the same config as kafka clients?

I agree this would NOT be backwards compatible in Flink source, but more align with Kafka clients

.stringType()
.noDefaultValue()
.withDescription(
"The complete client ID to use for Kafka consumers. If provided this will "
+ "take precedence over prefixes and subtask ID suffixes.");

public static final ConfigOption<Long> PARTITION_DISCOVERY_INTERVAL_MS =
ConfigOptions.key("partition.discovery.interval.ms")
.longType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ private void unassignPartitions(Collection<TopicPartition> partitionsToUnassign)
}

private String createConsumerClientId(Properties props) {
String providedClientId = props.getProperty(KafkaSourceOptions.COMPLETE_CLIENT_ID.key());
if (providedClientId != null) {
return providedClientId;
}

String prefix = props.getProperty(KafkaSourceOptions.CLIENT_ID_PREFIX.key());
return prefix + "-" + subtaskId;
}
Expand Down
Loading