T - the type of values being serialized@PublicEvolving public interface KafkaRecordSerializationSchema<T> extends Serializable
T to ProducerRecord.| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
KafkaRecordSerializationSchema.KafkaSinkContext
Context providing information of the kafka record target location.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> KafkaRecordSerializationSchemaBuilder<T> |
builder()
Creates a default schema builder to provide common building blocks i.e. key serialization,
value serialization, partitioning.
|
default void |
open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context,
KafkaRecordSerializationSchema.KafkaSinkContext sinkContext)
Initialization method for the schema.
|
org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> |
serialize(T element,
KafkaRecordSerializationSchema.KafkaSinkContext context,
Long timestamp)
Serializes given element and returns it as a
ProducerRecord. |
default void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context,
KafkaRecordSerializationSchema.KafkaSinkContext sinkContext)
throws Exception
serialize(Object, KafkaSinkContext, 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.sinkContext - runtime information i.e. partitions, subtaskIdException@Nullable org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> serialize(T element, KafkaRecordSerializationSchema.KafkaSinkContext context, Long timestamp)
ProducerRecord.element - element to be serializedcontext - context to possibly determine target partitiontimestamp - timestampProducerRecord or null if the given element cannot be serializedstatic <T> KafkaRecordSerializationSchemaBuilder<T> builder()
T - type of incoming elementsKafkaRecordSerializationSchemaBuilderCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.