boyuanzz commented on a change in pull request #13779:
URL: https://github.com/apache/beam/pull/13779#discussion_r562285062
##########
File path:
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
##########
@@ -586,8 +586,23 @@
setMaxReadTime(Duration.standardSeconds(config.maxReadTime));
}
setMaxNumRecords(config.maxNumRecords == null ? Long.MAX_VALUE :
config.maxNumRecords);
- setCommitOffsetsInFinalizeEnabled(false);
- setTimestampPolicyFactory(TimestampPolicyFactory.withProcessingTime());
+
+ // Set committing offset configuration.
+ setCommitOffsetsInFinalizeEnabled(config.commitOffsetInFinalize);
+
+ // Set timestamp policy with built-in types.
+ String timestampPolicy = config.timestampPolicy;
+ if (timestampPolicy.equals("ProcessingTime")) {
+
setTimestampPolicyFactory(TimestampPolicyFactory.withProcessingTime());
+ } else if (timestampPolicy.equals("CreateTime")) {
+
setTimestampPolicyFactory(TimestampPolicyFactory.withCreateTime(Duration.ZERO));
+ } else if (timestampPolicy.equals("LogAppendTime")) {
+
setTimestampPolicyFactory(TimestampPolicyFactory.withLogAppendTime());
+ } else {
+ throw new IllegalArgumentException(
+ "timestampPolicy should be one of (ProcessingTime, CreateTime,
LogAppendTime)");
+ }
Review comment:
+1 for `EnumerationType`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]