Class ValueAndTimestampSerializer<V>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      org.apache.kafka.common.serialization.Serializer<V> valueSerializer  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      static boolean compareValuesAndCheckForIncreasingTimestamp​(byte[] left, byte[] right)  
      void configure​(java.util.Map<java.lang.String,​?> configs, boolean isKey)  
      byte[] serialize​(java.lang.String topic, ValueAndTimestamp<V> data)  
      byte[] serialize​(java.lang.String topic, V data, long timestamp)  
      void setIfUnset​(org.apache.kafka.common.serialization.Serializer<java.lang.Void> defaultKeySerializer, org.apache.kafka.common.serialization.Serializer<V> defaultValueSerializer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.kafka.common.serialization.Serializer

        serialize
    • Field Detail

      • valueSerializer

        public final org.apache.kafka.common.serialization.Serializer<V> valueSerializer
    • Method Detail

      • compareValuesAndCheckForIncreasingTimestamp

        public static boolean compareValuesAndCheckForIncreasingTimestamp​(byte[] left,
                                                                          byte[] right)
        Parameters:
        left - the serialized byte array of the old record in state store
        right - the serialized byte array of the new record being processed
        Returns:
        true if the two serialized values are the same (excluding timestamp) or if the timestamp of right is less than left (indicating out of order record) false otherwise
      • configure

        public void configure​(java.util.Map<java.lang.String,​?> configs,
                              boolean isKey)
        Specified by:
        configure in interface org.apache.kafka.common.serialization.Serializer<V>
      • serialize

        public byte[] serialize​(java.lang.String topic,
                                ValueAndTimestamp<V> data)
        Specified by:
        serialize in interface org.apache.kafka.common.serialization.Serializer<V>
      • serialize

        public byte[] serialize​(java.lang.String topic,
                                V data,
                                long timestamp)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.kafka.common.serialization.Serializer<V>
      • setIfUnset

        public void setIfUnset​(org.apache.kafka.common.serialization.Serializer<java.lang.Void> defaultKeySerializer,
                               org.apache.kafka.common.serialization.Serializer<V> defaultValueSerializer)
        Specified by:
        setIfUnset in interface WrappingNullableSerializer<ValueAndTimestamp<V>,​java.lang.Void,​V>