Interface KafkaSerializationSchema<T>

Type Parameters:
T - the type of values being serialized
All Superinterfaces:
Serializable
All Known Implementing Classes:
KafkaSerializationSchemaWrapper

@PublicEvolving @Deprecated public interface KafkaSerializationSchema<T> extends Serializable
Deprecated.
Will be turned into internal API when FlinkKafkaProducer is removed.
A KafkaSerializationSchema defines how to serialize values of type T into ProducerRecords.

Please also implement KafkaContextAware if your serialization schema needs information about the available partitions and the number of parallel subtasks along with the subtask ID on which the Kafka Producer is running.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
    Deprecated.
    Initialization method for the schema.
    org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]>
    serialize(T element, Long timestamp)
    Deprecated.
    Serializes given element and returns it as a ProducerRecord.
  • Method Details

    • open

      default void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context) throws Exception
      Deprecated.
      Initialization method for the schema. It is called before the actual working methods serialize(Object, Long) and thus suitable for one time setup work.

      The provided SerializationSchema.InitializationContext can be used to access additional features such as e.g. registering user metrics.

      Parameters:
      context - Contextual information that can be used during initialization.
      Throws:
      Exception
    • serialize

      org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> serialize(T element, @Nullable Long timestamp)
      Deprecated.
      Serializes given element and returns it as a ProducerRecord.
      Parameters:
      element - element to be serialized
      timestamp - timestamp (can be null)
      Returns:
      Kafka ProducerRecord