K - The key type to be serialized.V - The value type to be serialized.@PublicEvolving 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>>
| 构造器和说明 |
|---|
TypeInformationKeyValueSerializationSchema(Class<K> keyClass,
Class<V> valueClass,
org.apache.flink.api.common.ExecutionConfig config)
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)
Creates a new de-/serialization schema for the given types.
|
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.flink.api.java.tuple.Tuple2<K,V> |
deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record)
Deserializes the Kafka record.
|
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.api.java.tuple.Tuple2<K,V>> |
getProducedType() |
String |
getTargetTopic(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
Optional method to determine the target topic for the element.
|
boolean |
isEndOfStream(org.apache.flink.api.java.tuple.Tuple2<K,V> nextElement)
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)
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)
Serializes the value of the incoming element to a byte array.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserialize, openpublic 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)
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.public TypeInformationKeyValueSerializationSchema(Class<K> keyClass, Class<V> valueClass, org.apache.flink.api.common.ExecutionConfig config)
If the types are parametrized and cannot be fully defined via classes, use the constructor
that accepts TypeInformation instead.
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.public org.apache.flink.api.java.tuple.Tuple2<K,V> deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record) throws Exception
KafkaDeserializationSchemadeserialize 在接口中 KafkaDeserializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>record - Kafka record to be deserialized.Exceptionpublic boolean isEndOfStream(org.apache.flink.api.java.tuple.Tuple2<K,V> nextElement)
isEndOfStream 在接口中 KafkaDeserializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>nextElement - The element to test for the end-of-stream signal.public byte[] serializeKey(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
KeyedSerializationSchemaserializeKey 在接口中 KeyedSerializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>element - The incoming element to be serializedpublic byte[] serializeValue(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
KeyedSerializationSchemaserializeValue 在接口中 KeyedSerializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>element - The incoming element to be serializedpublic String getTargetTopic(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
KeyedSerializationSchemagetTargetTopic 在接口中 KeyedSerializationSchema<org.apache.flink.api.java.tuple.Tuple2<K,V>>element - Incoming element to determine the target topic fromCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.