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>
public static class TimestampPolicyFactory.ProcessingTimePolicy<K,V> extends TimestampPolicy<K,V>
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 Constructor Description ProcessingTimePolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.joda.time.InstantgetTimestampForRecord(TimestampPolicy.PartitionContext context, KafkaRecord<K,V> record)Returns record timestamp (aka event time).org.joda.time.InstantgetWatermark(TimestampPolicy.PartitionContext context)Returns watermark for the partition.
-
-
-
Method Detail
-
getTimestampForRecord
public org.joda.time.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
public org.joda.time.Instant getWatermark(TimestampPolicy.PartitionContext context)
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>
-
-