Class DelegatingByTopicSerializer

java.lang.Object
org.springframework.kafka.support.serializer.DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
org.springframework.kafka.support.serializer.DelegatingByTopicSerializer
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.serialization.Serializer<Object>

public class DelegatingByTopicSerializer extends DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>> implements org.apache.kafka.common.serialization.Serializer<Object>
A Serializer that delegates to other serializers based on a topic pattern.
Since:
2.8
Author:
Gary Russell
  • Constructor Details

  • Method Details

    • configure

      public void configure(Map<String,?> configs, boolean isKey)
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Serializer<Object>
      Overrides:
      configure in class DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
    • configureDelegate

      protected org.apache.kafka.common.serialization.Serializer<?> configureDelegate(Map<String,?> configs, boolean isKey, org.apache.kafka.common.serialization.Serializer<?> delegate)
      Description copied from class: DelegatingByTopicSerialization
      Configure the delegate.
      Specified by:
      configureDelegate in class DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
      Parameters:
      configs - the configs.
      isKey - true if this is for keys.
      delegate - the delegate.
      Returns:
      the delegate.
    • isInstance

      protected boolean isInstance(Object instance)
      Description copied from class: DelegatingByTopicSerialization
      Return true if this object is an instance of T.
      Specified by:
      isInstance in class DelegatingByTopicSerialization<org.apache.kafka.common.serialization.Serializer<?>>
      Parameters:
      instance - the delegate.
      Returns:
      true if a T.
    • serialize

      public byte[] serialize(String topic, Object data)
      Specified by:
      serialize in interface org.apache.kafka.common.serialization.Serializer<Object>
    • serialize

      public byte[] serialize(String topic, org.apache.kafka.common.header.Headers headers, Object data)
      Specified by:
      serialize in interface org.apache.kafka.common.serialization.Serializer<Object>