public class CustomTimestampPolicyWithLimitedDelay<K,V> extends TimestampPolicy<K,V>
Min(now(), Max(event timestamp so far)) - max delay)'. However, watermark is never set in future and capped to 'now - max delay'. In addition, watermark advanced to 'now - max delay' when a partition is idle.
|Constructor and Description|
A policy for custom record timestamps where timestamps are expected to be roughly monotonically increasing with out of order event delays less than
|Modifier and Type||Method and Description|
Returns record timestamp (aka event time).
Returns watermark for the partition.
public CustomTimestampPolicyWithLimitedDelay(SerializableFunction<KafkaRecord<K,V>,Instant> timestampFunction, Duration maxDelay, java.util.Optional<Instant> previousWatermark)
maxDelay. The watermark at any time is
Min(now(), max_event_timestamp) - maxDelay.
timestampFunction- A function to extract timestamp from the record
maxDelay- For any record in the Kafka partition, the timestamp of any subsequent record is expected to be after
current record timestamp - maxDelay.
previousWatermark- Latest check-pointed watermark, see
public Instant getTimestampForRecord(TimestampPolicy.PartitionContext ctx, KafkaRecord<K,V> record)
public Instant getWatermark(TimestampPolicy.PartitionContext ctx)
UnboundedSource.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.