T - type of the object to marshall@Deprecated public class MessageConverterDelegateSerde<T> extends Object implements org.apache.kafka.common.serialization.Serde<T>
Serde implementation that wraps the list of MessageConverters 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.| Constructor and Description |
|---|
MessageConverterDelegateSerde(org.springframework.messaging.converter.CompositeMessageConverter compositeMessageConverter)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
|
void |
configure(Map<String,?> configs,
boolean isKey)
Deprecated.
|
org.apache.kafka.common.serialization.Deserializer<T> |
deserializer()
Deprecated.
|
org.apache.kafka.common.serialization.Serializer<T> |
serializer()
Deprecated.
|
public MessageConverterDelegateSerde(org.springframework.messaging.converter.CompositeMessageConverter compositeMessageConverter)
public void configure(Map<String,?> configs, boolean isKey)
configure in interface org.apache.kafka.common.serialization.Serde<T>public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface org.apache.kafka.common.serialization.Serde<T>public org.apache.kafka.common.serialization.Serializer<T> serializer()
serializer in interface org.apache.kafka.common.serialization.Serde<T>Copyright © 2022 Pivotal Software, Inc.. All rights reserved.