Class ParseStringDeserializer<T>
java.lang.Object
org.springframework.kafka.support.serializer.ParseStringDeserializer<T>
- Type Parameters:
T- class of the entity, representing messages
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.kafka.common.serialization.Deserializer<T>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance with no parser function; a static method name must be provided in the consumer configKEY_PARSERorVALUE_PARSERproperties.ParseStringDeserializer(BiFunction<String, org.apache.kafka.common.header.Headers, T> parser) Construct an instance with the supplied parser function.ParseStringDeserializer(Function<String, T> parser) Construct an instance with the supplied parser function. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(String topic, byte[] data) deserialize(String topic, @Nullable org.apache.kafka.common.header.Headers headers, byte[] data) deserialize(String topic, org.apache.kafka.common.header.Headers headers, ByteBuffer data) Get the configured charset.BiFunction<String, org.apache.kafka.common.header.Headers, T> Get the configured parser function.voidsetCharset(Charset charset) Set a charset to use when converting byte[] toString.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.serialization.Deserializer
close
-
Field Details
-
KEY_PARSER
-
VALUE_PARSER
-
-
Constructor Details
-
ParseStringDeserializer
public ParseStringDeserializer()Construct an instance with no parser function; a static method name must be provided in the consumer configKEY_PARSERorVALUE_PARSERproperties. -
ParseStringDeserializer
-
ParseStringDeserializer
public ParseStringDeserializer(BiFunction<String, org.apache.kafka.common.header.Headers, T> parser) Construct an instance with the supplied parser function. The function may receive null as the input value, for example for a tombstone record in a compacted topic.- Parameters:
parser- the function.
-
-
Method Details
-
configure
-
deserialize
-
deserialize
-
deserialize
- Specified by:
deserializein interfaceorg.apache.kafka.common.serialization.Deserializer<T>
-
setCharset
-
getCharset
-
getParser
Get the configured parser function.- Returns:
- the function.
-