Package org.apache.beam.sdk.io.kafka
Class TimestampPolicyFactory.LogAppendTimePolicy<K,V>
- java.lang.Object
-
- org.apache.beam.sdk.io.kafka.TimestampPolicy<K,V>
-
- org.apache.beam.sdk.io.kafka.TimestampPolicyFactory.LogAppendTimePolicy<K,V>
-
- Enclosing interface:
- TimestampPolicyFactory<KeyT,ValueT>
public static class TimestampPolicyFactory.LogAppendTimePolicy<K,V> extends TimestampPolicy<K,V>
Assigns Kafka's log append time (server side ingestion time) to each record. The watermark for each Kafka partition is the timestamp of the last record read. If a partition is idle, the watermark advances roughly to 'current time - 2 seconds'. SeeKafkaIO.Read.withLogAppendTime()for longer description.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.beam.sdk.io.kafka.TimestampPolicy
TimestampPolicy.PartitionContext
-
-
Field Summary
Fields Modifier and Type Field Description protected org.joda.time.InstantcurrentWatermark
-
Constructor Summary
Constructors Constructor Description LogAppendTimePolicy(java.util.Optional<org.joda.time.Instant> previousWatermark)
-
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>
-
-