Package org.apache.beam.sdk.io.kafka
Class TimestampPolicyFactory.ProcessingTimePolicy<K,V>
java.lang.Object
org.apache.beam.sdk.io.kafka.TimestampPolicy<K,V>
org.apache.beam.sdk.io.kafka.TimestampPolicyFactory.ProcessingTimePolicy<K,V>
- Enclosing interface:
TimestampPolicyFactory<KeyT,ValueT>
A simple policy that uses current time for event time and watermark. This should be used when
better timestamps like LogAppendTime are not available for a topic.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.io.kafka.TimestampPolicy
TimestampPolicy.PartitionContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTimestampForRecord(TimestampPolicy.PartitionContext context, KafkaRecord<K, V> record) Returns record timestamp (aka event time).Returns watermark for the partition.
-
Constructor Details
-
ProcessingTimePolicy
public ProcessingTimePolicy()
-
-
Method Details
-
getTimestampForRecord
public Instant getTimestampForRecord(TimestampPolicy.PartitionContext context, KafkaRecord<K, V> record) Description copied from class:TimestampPolicyReturns record timestamp (aka event time). This is often based on the timestamp of the Kafka record. This is invoked for each record when it is processed in the reader.- Specified by:
getTimestampForRecordin classTimestampPolicy<K,V>
-
getWatermark
Description copied from class:TimestampPolicyReturns watermark for the partition. It is the timestamp before or at the timestamps of all future records consumed from the partition. SeeUnboundedSource.UnboundedReader.getWatermark()for more guidance on watermarks. E.g. if the record timestamp is 'LogAppendTime', watermark would be the timestamp of the last record since 'LogAppendTime' monotonically increases within a partition.- Specified by:
getWatermarkin classTimestampPolicy<K,V>
-