@PublicEvolving public abstract class FlinkKafkaPartitioner<T> extends Object implements Serializable
FlinkKafkaPartitioner wraps logic on how to partition records across partitions of
multiple Kafka topics.| Constructor and Description |
|---|
FlinkKafkaPartitioner() |
| Modifier and Type | Method and Description |
|---|---|
void |
open(int parallelInstanceId,
int parallelInstances)
Initializer for the partitioner.
|
abstract int |
partition(T record,
byte[] key,
byte[] value,
String targetTopic,
int[] partitions)
Determine the id of the partition that the record should be written to.
|
public void open(int parallelInstanceId,
int parallelInstances)
parallelInstanceId - 0-indexed id of the parallel sink instance in FlinkparallelInstances - the total number of parallel instancespublic abstract int partition(T record, byte[] key, byte[] value, String targetTopic, int[] partitions)
record - the record valuekey - serialized key of the recordvalue - serialized value of the recordtargetTopic - target topic for the recordpartitions - found partitions for the target topicCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.