Class DelegatingByTopicSerialization<T extends Closeable>
java.lang.Object
org.springframework.kafka.support.serializer.DelegatingByTopicSerialization<T>
- Type Parameters:
T- the type.
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
DelegatingByTopicDeserializer,DelegatingByTopicSerializer
public abstract class DelegatingByTopicSerialization<T extends Closeable>
extends Object
implements Closeable
Base class with common code for delegating by topic serialization.
- Since:
- 2.8
- Author:
- Gary Russell
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSet to false to make topic pattern matching case-insensitive.static final StringName of the configuration property containing the serialization topic pattern map for keys with formatpattern:class,....static final StringName of the default delegate for keys when no topic name match is fount.static final StringName of the configuration property containing the serialization selector map for values with formatselector:class,....static final StringName of the default delegate for keys when no topic name match is fount. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDelegate(Pattern pattern, T serializer) protected voidprotected voidbuildDefault(Map<String, ?> configs, String configKey, boolean isKey, Object delegate) voidclose()protected voidprotected abstract TconfigureDelegate(Map<String, ?> configs, boolean isKey, T delegate) Configure the delegate.protected TfindDelegate(String topic) Determine the delegate for the topic.protected TinstantiateAndConfigure(Map<String, ?> configs, boolean isKey, Map<Pattern, T> delegates2, Pattern pattern, Class<?> clazz) protected abstract booleanisInstance(Object delegate) Return true if this object is an instance of T.removeDelegate(Pattern pattern) voidsetCaseSensitive(boolean caseSensitive) Set to false to make topic name matching case insensitive.
-
Field Details
-
VALUE_SERIALIZATION_TOPIC_CONFIG
Name of the configuration property containing the serialization selector map for values with formatselector:class,....- See Also:
-
KEY_SERIALIZATION_TOPIC_CONFIG
Name of the configuration property containing the serialization topic pattern map for keys with formatpattern:class,....- See Also:
-
VALUE_SERIALIZATION_TOPIC_DEFAULT
Name of the default delegate for keys when no topic name match is fount.- See Also:
-
KEY_SERIALIZATION_TOPIC_DEFAULT
Name of the default delegate for keys when no topic name match is fount.- See Also:
-
CASE_SENSITIVE
Set to false to make topic pattern matching case-insensitive.- See Also:
-
-
Constructor Details
-
DelegatingByTopicSerialization
public DelegatingByTopicSerialization() -
DelegatingByTopicSerialization
-
-
Method Details
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Set to false to make topic name matching case insensitive.- Parameters:
caseSensitive- false for case insensitive.
-
configure
-
build
-
buildDefault
-
configureDelegate
Configure the delegate.- Parameters:
configs- the configs.isKey- true if this is for keys.delegate- the delegate.- Returns:
- the delegate.
-
isInstance
Return true if this object is an instance of T.- Parameters:
delegate- the delegate.- Returns:
- true if a T.
-
instantiateAndConfigure
-
addDelegate
-
removeDelegate
-
findDelegate
Determine the delegate for the topic.- Parameters:
topic- the topic.- Returns:
- the delegate.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-