Class RecordTimestampAssigner<E>

  • All Implemented Interfaces:
    TimestampAssigner<E>

    @Public
    public final class RecordTimestampAssigner<E>
    extends Object
    implements TimestampAssigner<E>
    A TimestampAssigner that forwards the already-assigned timestamp. This is for use when records come out of a source with valid timestamps, for example from the Kafka Metadata.
    • Constructor Detail

      • RecordTimestampAssigner

        public RecordTimestampAssigner()
    • Method Detail

      • extractTimestamp

        public long extractTimestamp​(E element,
                                     long recordTimestamp)
        Description copied from interface: TimestampAssigner
        Assigns a timestamp to an element, in milliseconds since the Epoch. This is independent of any particular time zone or calendar.

        The method is passed the previously assigned timestamp of the element. That previous timestamp may have been assigned from a previous assigner. If the element did not carry a timestamp before, this value is TimestampAssigner.NO_TIMESTAMP (= Long.MIN_VALUE: -9223372036854775808L).

        Specified by:
        extractTimestamp in interface TimestampAssigner<E>
        Parameters:
        element - The element that the timestamp will be assigned to.
        recordTimestamp - The current internal timestamp of the element, or a negative value, if no timestamp has been assigned yet.
        Returns:
        The new timestamp.