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 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.
Since:
3.0
Author:
Soby Chacko
  • Constructor Details

    • MessageConverterDelegateSerde

      public MessageConverterDelegateSerde(org.springframework.messaging.converter.CompositeMessageConverter compositeMessageConverter)
      Deprecated.
  • Method Details

    • configure

      public void configure(Map<String,?> configs, boolean isKey)
      Deprecated.
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Serde<T>
    • close

      public void close()
      Deprecated.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.common.serialization.Serde<T>
    • serializer

      public org.apache.kafka.common.serialization.Serializer<T> serializer()
      Deprecated.
      Specified by:
      serializer in interface org.apache.kafka.common.serialization.Serde<T>
    • deserializer

      public org.apache.kafka.common.serialization.Deserializer<T> deserializer()
      Deprecated.
      Specified by:
      deserializer in interface org.apache.kafka.common.serialization.Serde<T>