public class FixedPartitioner<T> extends KafkaPartitioner<T> implements Serializable
Flink Sinks: Kafka Partitions
1 ----------------> 1
2 --------------/
3 -------------/
4 ------------/
Some (or all) kafka partitions contain the output of more than one flink partition
# Fewer Flink partitions than Kafka
Flink Sinks: Kafka Partitions
1 ----------------> 1
2 ----------------> 2
3
4
5
Not all Kafka partitions contain data
To avoid such an unbalanced partitioning, use a round-robin kafka partitioner. (note that this will
cause a lot of network connections between all the Flink instances and all the Kafka brokers| Constructor and Description |
|---|
FixedPartitioner() |
public void open(int parallelInstanceId,
int parallelInstances,
int[] partitions)
KafkaPartitioneropen in class KafkaPartitioner<T>parallelInstanceId - 0-indexed id of the parallel instance in FlinkparallelInstances - the total number of parallel instancespartitions - an array describing the partition IDs of the available Kafka partitions.public int partition(T next, byte[] serializedKey, byte[] serializedValue, int numPartitions)
partition in class KafkaPartitioner<T>Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.