Class DelegatingByTopicSerializer
java.lang.Object
org.springframework.kafka.support.serializer.DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
org.springframework.kafka.support.serializer.DelegatingByTopicSerializer
- All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.serialization.Serializer<Object>
public class DelegatingByTopicSerializer
extends DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
implements org.apache.kafka.common.serialization.Serializer<Object>
A
Serializer that delegates to other serializers based on a topic pattern.- Since:
- 2.8
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance that will be configured inconfigure(Map, boolean)with producer propertiesDelegatingByTopicSerialization.VALUE_SERIALIZATION_TOPIC_CONFIGandDelegatingByTopicSerialization.KEY_SERIALIZATION_TOPIC_CONFIG.DelegatingByTopicSerializer(Map<Pattern, org.apache.kafka.common.serialization.Serializer<?>> delegates, org.apache.kafka.common.serialization.Serializer<?> defaultDelegate) Construct an instance with the supplied mapping of topic patterns to delegate serializers. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.apache.kafka.common.serialization.Serializer<?> configureDelegate(Map<String, ?> configs, boolean isKey, org.apache.kafka.common.serialization.Serializer<?> delegate) Configure the delegate.protected booleanisInstance(Object instance) Return true if this object is an instance of T.byte[]byte[]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.Serializer
close
-
Constructor Details
-
DelegatingByTopicSerializer
public DelegatingByTopicSerializer()Construct an instance that will be configured inconfigure(Map, boolean)with producer propertiesDelegatingByTopicSerialization.VALUE_SERIALIZATION_TOPIC_CONFIGandDelegatingByTopicSerialization.KEY_SERIALIZATION_TOPIC_CONFIG. -
DelegatingByTopicSerializer
public DelegatingByTopicSerializer(Map<Pattern, org.apache.kafka.common.serialization.Serializer<?>> delegates, org.apache.kafka.common.serialization.Serializer<?> defaultDelegate) Construct an instance with the supplied mapping of topic patterns to delegate serializers.- 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.Serializer<Object>- Overrides:
configurein classDelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
-
configureDelegate
protected org.apache.kafka.common.serialization.Serializer<?> configureDelegate(Map<String, ?> configs, boolean isKey, org.apache.kafka.common.serialization.Serializer<?> delegate) Description copied from class:DelegatingByTopicSerializationConfigure the delegate.- Specified by:
configureDelegatein classDelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>- 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.Serializer<?>>- Parameters:
instance- the delegate.- Returns:
- true if a T.
-
serialize
-
serialize
-