Class DelegatingDeserializer
java.lang.Object
org.springframework.kafka.support.serializer.DelegatingDeserializer
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- org.apache.kafka.common.serialization.Deserializer<Object>
public class DelegatingDeserializer
extends Object
implements org.apache.kafka.common.serialization.Deserializer<Object>
A 
Deserializer that delegates to other deserializers based on a serialization
 selector header. It is not necessary to configure standard deserializers supported by
 Serdes.- Since:
- 2.3
- Author:
- Gary Russell, Wang Zhiyang
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an instance that will be configured inconfigure(Map, boolean)with consumer propertiesDelegatingSerializer.KEY_SERIALIZATION_SELECTOR_CONFIGandDelegatingSerializer.VALUE_SERIALIZATION_SELECTOR_CONFIG.DelegatingDeserializer(Map<String, org.apache.kafka.common.serialization.Deserializer<?>> delegates) Construct an instance with the supplied mapping of selectors to delegate deserializers.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDelegate(String selector, org.apache.kafka.common.serialization.Deserializer<?> deserializer) voidclose()voidcreateDelegates(String mappings, Map<String, ?> configs, boolean isKey) protected static voidcreateInstanceAndConfigure(Map<String, ?> configs, boolean isKey, Map<String, org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, String selector, String className) deserialize(String topic, byte[] data) deserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data) deserialize(String topic, org.apache.kafka.common.header.Headers headers, ByteBuffer data) protected static voidinstantiateAndConfigure(Map<String, ?> configs, boolean isKey, Map<String, org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, String selector, Class<?> clazz) org.apache.kafka.common.serialization.Deserializer<?>removeDelegate(String selector) 
- 
Constructor Details- 
DelegatingDeserializerpublic DelegatingDeserializer()Construct an instance that will be configured inconfigure(Map, boolean)with consumer propertiesDelegatingSerializer.KEY_SERIALIZATION_SELECTOR_CONFIGandDelegatingSerializer.VALUE_SERIALIZATION_SELECTOR_CONFIG.
- 
DelegatingDeserializerpublic DelegatingDeserializer(Map<String, org.apache.kafka.common.serialization.Deserializer<?>> delegates) Construct an instance with the supplied mapping of selectors to delegate deserializers. The selector must be supplied in theDelegatingSerializer.KEY_SERIALIZATION_SELECTOR_CONFIGandDelegatingSerializer.VALUE_SERIALIZATION_SELECTOR_CONFIGheaders. It is not necessary to configure standard deserializers supported bySerdes.- Parameters:
- delegates- the map of delegates.
 
 
- 
- 
Method Details- 
configure- Specified by:
- configurein interface- org.apache.kafka.common.serialization.Deserializer<Object>
 
- 
createDelegates
- 
createInstanceAndConfigure
- 
instantiateAndConfigure
- 
addDelegatepublic void addDelegate(String selector, org.apache.kafka.common.serialization.Deserializer<?> deserializer) 
- 
removeDelegate
- 
deserialize- Specified by:
- deserializein interface- org.apache.kafka.common.serialization.Deserializer<Object>
 
- 
deserializepublic Object deserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data) - Specified by:
- deserializein interface- org.apache.kafka.common.serialization.Deserializer<Object>
 
- 
deserializepublic Object deserialize(String topic, org.apache.kafka.common.header.Headers headers, ByteBuffer data) - Specified by:
- deserializein interface- org.apache.kafka.common.serialization.Deserializer<Object>
 
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- org.apache.kafka.common.serialization.Deserializer<Object>
 
 
-