T - the type of values being serialized@PublicEvolving public interface KafkaSerializationSchema<T> extends Serializable
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.
| 限定符和类型 | 方法和说明 |
|---|---|
default void |
open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
Initialization method for the schema.
|
org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> |
serialize(T element,
Long timestamp)
Serializes given element and returns it as a
ProducerRecord. |
default void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
throws Exception
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.
context - Contextual information that can be used during initialization.ExceptionCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.