Hi all,
I am using flink 1.7.0 and using this constructor

FlinkKafkaProducer(String topicId, KeyedSerializationSchema<IN>
serializationSchema, Properties producerConfig)

>From the doc it says this constructor uses fixed partitioner. I want to
partition based on key , so I tried to use this

public FlinkKafkaProducer(
   String defaultTopicId,
   KeyedSerializationSchema<IN> serializationSchema,
   Properties producerConfig,
   Optional<FlinkKafkaPartitioner<IN>> customPartitioner)

What should I pass in the optional field ? From the doc it says

@param customPartitioner A serializable partitioner for assigning
messages to Kafka partitions.
*                          If a partitioner is not provided, records
will be partitioned by the key of each record
*                          (determined by {@link
KeyedSerializationSchema#serializeKey(Object)}). If the keys
*                          are {@code null}, then records will be
distributed to Kafka partitions in a
*                          round-robin fashion.

This is super confusing(contradicting in a way) since the previous
constructor says that fixedpartitioner will be used if customPartioner is
not present.

Best,
Vishwas

Reply via email to