public abstract class TimestampPolicy<K,V>
extends java.lang.Object
TimestampPolicyFactory
for each each of the
partitions it reads from. See @TimestampPolicyFactory.LogAppendTimePolicy
for example
of a policy.Modifier and Type | Class and Description |
---|---|
static class |
TimestampPolicy.PartitionContext
The context contains state maintained in the reader for the partition.
|
Constructor and Description |
---|
TimestampPolicy() |
Modifier and Type | Method and Description |
---|---|
abstract Instant |
getTimestampForRecord(TimestampPolicy.PartitionContext ctx,
KafkaRecord<K,V> record)
Returns record timestamp (aka event time).
|
abstract Instant |
getWatermark(TimestampPolicy.PartitionContext ctx)
Returns watermark for the partition.
|
public abstract Instant getTimestampForRecord(TimestampPolicy.PartitionContext ctx, KafkaRecord<K,V> record)
public abstract 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.