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 5Not 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() |
Modifier and Type | Method and Description |
---|---|
void |
open(int parallelInstanceId,
int parallelInstances,
int[] partitions)
Initializer for the Partitioner.
|
int |
partition(T next,
byte[] serializedKey,
byte[] serializedValue,
int numPartitions) |
public void open(int parallelInstanceId, int parallelInstances, int[] partitions)
KafkaPartitioner
open
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–2017 The Apache Software Foundation. All rights reserved.