Class ValueAndTimestampSerializer<V>
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.ValueAndTimestampSerializer<V>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Serializer<ValueAndTimestamp<V>>
,WrappingNullableSerializer<ValueAndTimestamp<V>,Void,V>
public class ValueAndTimestampSerializer<V> extends Object implements WrappingNullableSerializer<ValueAndTimestamp<V>,Void,V>
-
-
Field Summary
Fields Modifier and Type Field Description Serializer<V>
valueSerializer
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this serializer.static boolean
compareValuesAndCheckForIncreasingTimestamp(byte[] left, byte[] right)
void
configure(Map<String,?> configs, boolean isKey)
Configure this class.byte[]
serialize(String topic, ValueAndTimestamp<V> data)
Convertdata
into a byte array.byte[]
serialize(String topic, V data, long timestamp)
void
setIfUnset(Serializer<Void> defaultKeySerializer, 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 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 storeright
- 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(Map<String,?> configs, boolean isKey)
Description copied from interface:Serializer
Configure this class.- Specified by:
configure
in interfaceSerializer<V>
- Parameters:
configs
- configs in key/value pairsisKey
- whether is for key or value
-
serialize
public byte[] serialize(String topic, ValueAndTimestamp<V> data)
Description copied from interface:Serializer
Convertdata
into a byte array.- Specified by:
serialize
in interfaceSerializer<V>
- Parameters:
topic
- topic associated with datadata
- typed data- Returns:
- serialized bytes
-
close
public void close()
Description copied from interface:Serializer
Close this serializer.This method must be idempotent as it may be called multiple times.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSerializer<V>
-
setIfUnset
public void setIfUnset(Serializer<Void> defaultKeySerializer, Serializer<V> defaultValueSerializer)
- Specified by:
setIfUnset
in interfaceWrappingNullableSerializer<ValueAndTimestamp<V>,Void,V>
-
-