Class DelegatingByTopicDeserializer
java.lang.Object
org.springframework.kafka.support.serializer.DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Deserializer<?>>
org.springframework.kafka.support.serializer.DelegatingByTopicDeserializer
- All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.serialization.Deserializer<Object>
public class DelegatingByTopicDeserializer
extends DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Deserializer<?>>
implements org.apache.kafka.common.serialization.Deserializer<Object>
A
Deserializer that delegates to other deserializers based on the topic name.- Since:
- 2.8
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance that will be configured inconfigure(Map, boolean)with consumer properties.DelegatingByTopicDeserializer(Map<Pattern, org.apache.kafka.common.serialization.Deserializer<?>> delegates, org.apache.kafka.common.serialization.Deserializer<?> defaultDelegate) Construct an instance with the supplied mapping of topic name patterns to delegate deserializers. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.apache.kafka.common.serialization.Deserializer<?> configureDelegate(Map<String, ?> configs, boolean isKey, org.apache.kafka.common.serialization.Deserializer<?> delegate) Configure the delegate.deserialize(String topic, byte[] data) @Nullable Objectdeserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data) @Nullable Objectdeserialize(String topic, org.apache.kafka.common.header.Headers headers, ByteBuffer data) protected booleanisInstance(Object delegate) Return true if this object is an instance of T.Methods inherited from class DelegatingByTopicSerialization
addDelegate, build, buildDefault, close, findDelegate, instantiateAndConfigure, removeDelegate, setCaseSensitiveMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.serialization.Deserializer
close
-
Constructor Details
-
DelegatingByTopicDeserializer
public DelegatingByTopicDeserializer()Construct an instance that will be configured inconfigure(Map, boolean)with consumer properties. -
DelegatingByTopicDeserializer
public DelegatingByTopicDeserializer(Map<Pattern, org.apache.kafka.common.serialization.Deserializer<?>> delegates, org.apache.kafka.common.serialization.Deserializer<?> defaultDelegate) Construct an instance with the supplied mapping of topic name patterns to delegate deserializers.- Parameters:
delegates- the map of delegates.defaultDelegate- the default to use when no topic name match.
-
-
Method Details
-
configure
- Specified by:
configurein interfaceorg.apache.kafka.common.serialization.Deserializer<Object>- Overrides:
configurein classDelegatingByTopicSerialization<org.apache.kafka.common.serialization.Deserializer<?>>
-
configureDelegate
protected org.apache.kafka.common.serialization.Deserializer<?> configureDelegate(Map<String, ?> configs, boolean isKey, org.apache.kafka.common.serialization.Deserializer<?> delegate) Description copied from class:DelegatingByTopicSerializationConfigure the delegate.- Specified by:
configureDelegatein classDelegatingByTopicSerialization<org.apache.kafka.common.serialization.Deserializer<?>>- Parameters:
configs- the configs.isKey- true if this is for keys.delegate- the delegate.- Returns:
- the delegate.
-
isInstance
Description copied from class:DelegatingByTopicSerializationReturn true if this object is an instance of T.- Specified by:
isInstancein classDelegatingByTopicSerialization<org.apache.kafka.common.serialization.Deserializer<?>>- Parameters:
delegate- the delegate.- Returns:
- true if a T.
-
deserialize
-
deserialize
-
deserialize
public @Nullable Object deserialize(String topic, org.apache.kafka.common.header.Headers headers, ByteBuffer data) - Specified by:
deserializein interfaceorg.apache.kafka.common.serialization.Deserializer<Object>
-