Repository navigation
[KafkaIO] Add with_gcp_adc and num_partitions options to Kafka SchemaTransforms and YAML
#40181
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,6 +198,21 @@ public static Builder builder() { | |
| @Nullable | ||
| public abstract Boolean getRedistributeByRecordKey(); | ||
|
|
||
| @SchemaFieldDescription( | ||
| "Whether to use Google Application Default Credentials (ADC) for authenticating with a " | ||
| + "Google Managed Kafka cluster.") | ||
| @SchemaFieldNumber("17") | ||
| @Nullable | ||
| public abstract Boolean getWithGcpAdc(); | ||
|
|
||
| @SchemaFieldDescription( | ||
| "The number of partitions to read from the Kafka topic. If specified, partitions" | ||
| + " 0 to numPartitions-1 will be assigned statically without querying Kafka at pipeline" | ||
| + " construction time.") | ||
| @SchemaFieldNumber("18") | ||
| @Nullable | ||
| public abstract Integer getNumPartitions(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In most cases the partition set for a topic will match the range of integers from 0 to N, but users may arbitrarily retire individual partitions.
Replacing the number of partitions property with a topic partition list property would spare adding it later with more boilerplate to validate the different combinations of configuration properties.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's true there is a risk number of partitions evolving won't get honored, but in fact it's the same limitation for a typical setup
There is an One of the motivation of exposing this option is to be able to use KafkaIO via SchemaTransform to connect to a GMK on Dataflow Streaming runner, therefore |
||
|
|
||
| /** Builder for the {@link KafkaReadSchemaTransformConfiguration}. */ | ||
| @AutoValue.Builder | ||
| public abstract static class Builder { | ||
|
|
@@ -238,6 +253,10 @@ public abstract static class Builder { | |
|
|
||
| public abstract Builder setRedistributeByRecordKey(Boolean redistributeByRecordKey); | ||
|
|
||
| public abstract Builder setWithGcpAdc(Boolean withGcpAdc); | ||
|
|
||
| public abstract Builder setNumPartitions(Integer numPartitions); | ||
|
|
||
| /** Builds a {@link KafkaReadSchemaTransformConfiguration} instance. */ | ||
| public abstract KafkaReadSchemaTransformConfiguration build(); | ||
| } | ||
|
|
||
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.
Nit: This doesn't match the name used to configure the transform. Application default credentials is annoyingly long to spell so I'm not opposed to ADC, but I'd consider keeping it the same for consistency and clarity to users who might be unfamiliar with the acronym.
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.
Understand. Since this is mostly a ease-of-use change (users can current set GCP configs themselves by adding all needed configurations to config) a simple name is preferred
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.
SGTM