You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by yh...@apache.org on 2025/08/07 19:14:32 UTC
(beam) branch master updated: Add javadoc comments for public methods related to KafkaIO redistribute. (#35812)
This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 45cac8cd7d2 Add javadoc comments for public methods related to KafkaIO redistribute. (#35812)
45cac8cd7d2 is described below
commit 45cac8cd7d2cac04cd7fa8be0bea9d7017b20884
Author: Tom Stepp <to...@gmail.com>
AuthorDate: Thu Aug 7 12:14:24 2025 -0700
Add javadoc comments for public methods related to KafkaIO redistribute. (#35812)
* Add javadoc comments for public methods related to KafkaIO redistribute.
* Add formatting to javadoc comments
* Add param and return comments
* Run ./gradlew :sdks:java:io:kafka:spotlessApply
---
.../java/org/apache/beam/sdk/io/kafka/KafkaIO.java | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java b/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
index bbe20b1ed63..b113128efb6 100644
--- a/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
+++ b/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
@@ -1093,19 +1093,55 @@ public class KafkaIO {
/**
* Sets redistribute transform that hints to the runner to try to redistribute the work evenly.
+ *
+ * @return an updated {@link Read} transform.
*/
public Read<K, V> withRedistribute() {
return toBuilder().setRedistributed(true).build();
}
+ /**
+ * Hints to the runner that it can relax exactly-once processing guarantees, allowing duplicates
+ * in at-least-once processing mode of Kafka inputs.
+ *
+ * <p>Must be used with {@link KafkaIO#withRedistribute()}.
+ *
+ * <p>Not compatible with {@link KafkaIO#withOffsetDeduplication()}.
+ *
+ * @param allowDuplicates specifies whether to allow duplicates.
+ * @return an updated {@link Read} transform.
+ */
public Read<K, V> withAllowDuplicates(Boolean allowDuplicates) {
return toBuilder().setAllowDuplicates(allowDuplicates).build();
}
+ /**
+ * Redistributes Kafka messages into a distinct number of keys for processing in subsequent
+ * steps.
+ *
+ * <p>Specifying an explicit number of keys is generally recommended over redistributing into an
+ * unbounded key space.
+ *
+ * <p>Must be used with {@link KafkaIO#withRedistribute()}.
+ *
+ * @param redistributeNumKeys specifies the total number of keys for redistributing inputs.
+ * @return an updated {@link Read} transform.
+ */
public Read<K, V> withRedistributeNumKeys(int redistributeNumKeys) {
return toBuilder().setRedistributeNumKeys(redistributeNumKeys).build();
}
+ /**
+ * Hints to the runner to optimize the redistribute by minimizing the amount of data required
+ * for persistence as part of the redistribute operation.
+ *
+ * <p>Must be used with {@link KafkaIO#withRedistribute()}.
+ *
+ * <p>Not compatible with {@link KafkaIO#withAllowDuplicates()}.
+ *
+ * @param offsetDeduplication specifies whether to enable offset-based deduplication.
+ * @return an updated {@link Read} transform.
+ */
public Read<K, V> withOffsetDeduplication(Boolean offsetDeduplication) {
return toBuilder().setOffsetDeduplication(offsetDeduplication).build();
}