1
我試圖使用ProducerRecord
將消息發送到KafkaProducer
。Kafka - DefaultPartitioner與MessageKey與自定義分區程序的區別?
new ProducerRecord(topicName,messageKey,message)
這使用DefaultPartitioner
,DefaultPartitioner將使用密鑰的哈希值,以確保對於同一個密鑰的所有消息去同一個分區。
這和使用CustomPartitioner
有什麼區別?我希望自定義分區程序也用於將消息發送到基於Key的同一分區。