Interface TimestampPolicyFactory<KeyT,​ValueT>

    • Method Detail

      • createTimestampPolicy

        TimestampPolicy<KeyT,​ValueT> createTimestampPolicy​(org.apache.kafka.common.TopicPartition tp,
                                                                 java.util.Optional<org.joda.time.Instant> previousWatermark)
        Creates a TimestampPolicy for a partition. This is invoked by the reader at the start or while resuming from previous checkpoint.
        Parameters:
        tp - The returned policy applies to records from this TopicPartition.
        previousWatermark - The latest check-pointed watermark. This is set when the reader is resuming from a checkpoint. This is a good value to return by implementations of TimestampPolicy.getWatermark(PartitionContext) until a better watermark can be established as more records are read.
      • withProcessingTime

        static <K,​V> TimestampPolicyFactory<K,​V> withProcessingTime()
        A TimestampPolicy that assigns processing time to each record. Specifically, this is the timestamp when the record becomes 'current' in the reader. The watermark aways advances to current time.
      • withLogAppendTime

        static <K,​V> TimestampPolicyFactory<K,​V> withLogAppendTime()
        A TimestampPolicy that 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'. See KafkaIO.Read.withLogAppendTime() for longer description.