Class MessageConverterDelegateSerde<T>
java.lang.Object
org.springframework.cloud.stream.binder.kafka.streams.serde.MessageConverterDelegateSerde<T>
- Type Parameters:
T
- type of the object to marshall
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.kafka.common.serialization.Serde<T>
- Direct Known Subclasses:
CompositeNonNativeSerde
@Deprecated
public class MessageConverterDelegateSerde<T>
extends Object
implements org.apache.kafka.common.serialization.Serde<T>
Deprecated.
in favor of other schema registry providers instead of Spring Cloud Schema Registry. See its motivation above.
A
Serde
implementation that wraps the list of MessageConverter
s from
CompositeMessageConverter
.
The primary motivation for this class is to provide an avro based Serde
that is
compatible with the schema registry that Spring Cloud Stream provides. When using the
schema registry support from Spring Cloud Stream in a Kafka Streams binder based
application, the applications can deserialize the incoming Kafka Streams records using
the built in Avro MessageConverter
. However, this same message conversion
approach will not work downstream in other operations in the topology for Kafka Streams
as some of them needs a Serde
instance that can talk to the Spring Cloud Stream
provided Schema Registry. This implementation will solve that problem.
Only Avro and JSON based converters are exposed as binder provided Serde
implementations currently.
Users of this class must call the
configure(Map, boolean)
method to configure the
Serde
object. At the very least the configuration map must include a key called
"valueClass" to indicate the type of the target object for deserialization. If any
other content type other than JSON is needed (only Avro is available now other than
JSON), that needs to be included in the configuration map with the key "contentType".
For example,
Map<String, Object> config = new HashMap<>(); config.put("valueClass", Foo.class); config.put("contentType", "application/avro");Then use the above map when calling the configure method. This class is only intended to be used when writing a Spring Cloud Stream Kafka Streams application that uses Spring Cloud Stream schema registry for schema evolution. An instance of this class is provided as a bean by the binder configuration and typically the applications can autowire that bean. This is the expected usage pattern of this class.
- Since:
- 3.0
- Author:
- Soby Chacko
-
Constructor Summary
ConstructorsConstructorDescriptionMessageConverterDelegateSerde
(org.springframework.messaging.converter.CompositeMessageConverter compositeMessageConverter) Deprecated. -
Method Summary
-
Constructor Details
-
MessageConverterDelegateSerde
public MessageConverterDelegateSerde(org.springframework.messaging.converter.CompositeMessageConverter compositeMessageConverter) Deprecated.
-
-
Method Details
-
configure
Deprecated.- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Serde<T>
-
close
public void close()Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Serde<T>
-
serializer
Deprecated.- Specified by:
serializer
in interfaceorg.apache.kafka.common.serialization.Serde<T>
-
deserializer
Deprecated.- Specified by:
deserializer
in interfaceorg.apache.kafka.common.serialization.Serde<T>
-