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, Wang Zhiyang
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Set to false to make topic pattern matching case-insensitive.static final String
Name of the configuration property containing the serialization topic pattern map for keys with formatpattern:class,...
.static final String
Name of the default delegate for keys when no topic name match is fount.static final String
Name of the configuration property containing the serialization selector map for values with formatselector:class,...
.static final String
Name of the default delegate for keys when no topic name match is fount. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDelegate
(Pattern pattern, T serializer) protected void
protected void
buildDefault
(Map<String, ?> configs, String configKey, boolean isKey, Object delegate) void
close()
protected void
protected abstract T
configureDelegate
(Map<String, ?> configs, boolean isKey, T delegate) Configure the delegate.protected T
findDelegate
(String topic) Determine the delegate for the topic.protected T
instantiateAndConfigure
(Map<String, ?> configs, boolean isKey, Map<Pattern, T> delegates2, Pattern pattern, Class<?> clazz) protected abstract boolean
isInstance
(Object delegate) Return true if this object is an instance of T.removeDelegate
(Pattern pattern) void
setCaseSensitive
(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-