A
Serde implementation that wraps the list of
MessageConverters
from
CompositeMessageConverterFactory.
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.