Class TypeInformationKeyValueSerializationSchema<K,V>

java.lang.Object
org.apache.flink.streaming.util.serialization.TypeInformationKeyValueSerializationSchema<K,V>
Type Parameters:
K - The key type to be serialized.
V - The value type to be serialized.
All Implemented Interfaces:
Serializable, org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.api.java.tuple.Tuple2<K,V>>, KafkaDeserializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>, KeyedSerializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>

@PublicEvolving @Deprecated public class TypeInformationKeyValueSerializationSchema<K,V> extends Object implements KafkaDeserializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>, KeyedSerializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>
Deprecated.
A serialization and deserialization schema for Key Value Pairs that uses Flink's serialization stack to transform typed from and to byte arrays.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TypeInformationKeyValueSerializationSchema(Class<K> keyClass, Class<V> valueClass, org.apache.flink.api.common.ExecutionConfig config)
    Deprecated.
    Creates a new de-/serialization schema for the given types.
    TypeInformationKeyValueSerializationSchema(org.apache.flink.api.common.typeinfo.TypeInformation<K> keyTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<V> valueTypeInfo, org.apache.flink.api.common.ExecutionConfig ec)
    Deprecated.
    Creates a new de-/serialization schema for the given types.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.api.java.tuple.Tuple2<K,V>
    deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record)
    Deprecated.
    Deserializes the Kafka record.
    org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.api.java.tuple.Tuple2<K,V>>
    Deprecated.
     
    getTargetTopic(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
    Deprecated.
    Optional method to determine the target topic for the element.
    boolean
    isEndOfStream(org.apache.flink.api.java.tuple.Tuple2<K,V> nextElement)
    Deprecated.
    This schema never considers an element to signal end-of-stream, so this method returns always false.
    byte[]
    serializeKey(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
    Deprecated.
    Serializes the key of the incoming element to a byte array This method might return null if no key is available.
    byte[]
    serializeValue(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
    Deprecated.
    Serializes the value of the incoming element to a byte array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.flink.streaming.connectors.kafka.KafkaDeserializationSchema

    deserialize, open
  • Constructor Details

    • TypeInformationKeyValueSerializationSchema

      public TypeInformationKeyValueSerializationSchema(org.apache.flink.api.common.typeinfo.TypeInformation<K> keyTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<V> valueTypeInfo, org.apache.flink.api.common.ExecutionConfig ec)
      Deprecated.
      Creates a new de-/serialization schema for the given types.
      Parameters:
      keyTypeInfo - The type information for the key type de-/serialized by this schema.
      valueTypeInfo - The type information for the value type de-/serialized by this schema.
      ec - The execution config, which is used to parametrize the type serializers.
    • TypeInformationKeyValueSerializationSchema

      public TypeInformationKeyValueSerializationSchema(Class<K> keyClass, Class<V> valueClass, org.apache.flink.api.common.ExecutionConfig config)
      Deprecated.
      Creates a new de-/serialization schema for the given types. This constructor accepts the types as classes and internally constructs the type information from the classes.

      If the types are parametrized and cannot be fully defined via classes, use the constructor that accepts TypeInformation instead.

      Parameters:
      keyClass - The class of the key de-/serialized by this schema.
      valueClass - The class of the value de-/serialized by this schema.
      config - The execution config, which is used to parametrize the type serializers.
  • Method Details

    • deserialize

      public org.apache.flink.api.java.tuple.Tuple2<K,V> deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record) throws Exception
      Deprecated.
      Description copied from interface: KafkaDeserializationSchema
      Deserializes the Kafka record.
      Specified by:
      deserialize in interface KafkaDeserializationSchema<K>
      Parameters:
      record - Kafka record to be deserialized.
      Returns:
      The deserialized message as an object (null if the message cannot be deserialized).
      Throws:
      Exception
    • isEndOfStream

      public boolean isEndOfStream(org.apache.flink.api.java.tuple.Tuple2<K,V> nextElement)
      Deprecated.
      This schema never considers an element to signal end-of-stream, so this method returns always false.
      Specified by:
      isEndOfStream in interface KafkaDeserializationSchema<K>
      Parameters:
      nextElement - The element to test for the end-of-stream signal.
      Returns:
      Returns false.
    • serializeKey

      public byte[] serializeKey(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
      Deprecated.
      Description copied from interface: KeyedSerializationSchema
      Serializes the key of the incoming element to a byte array This method might return null if no key is available.
      Specified by:
      serializeKey in interface KeyedSerializationSchema<K>
      Parameters:
      element - The incoming element to be serialized
      Returns:
      the key of the element as a byte array
    • serializeValue

      public byte[] serializeValue(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
      Deprecated.
      Description copied from interface: KeyedSerializationSchema
      Serializes the value of the incoming element to a byte array.
      Specified by:
      serializeValue in interface KeyedSerializationSchema<K>
      Parameters:
      element - The incoming element to be serialized
      Returns:
      the value of the element as a byte array
    • getTargetTopic

      public String getTargetTopic(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
      Deprecated.
      Description copied from interface: KeyedSerializationSchema
      Optional method to determine the target topic for the element.
      Specified by:
      getTargetTopic in interface KeyedSerializationSchema<K>
      Parameters:
      element - Incoming element to determine the target topic from
      Returns:
      null or the target topic
    • getProducedType

      public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.api.java.tuple.Tuple2<K,V>> getProducedType()
      Deprecated.
      Specified by:
      getProducedType in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<K>