配置
# 自定义分区
# partitioner:
# class: com.dfree.data.config.PartitionerByKey
代码标签:numPartitions,分区,kafka,int,key,按键,Override,public From: https://www.cnblogs.com/daofree/p/18086575
//public class PartitionerByKey implements Partitioner {
// @Override
// public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) {
// int numPartitions = cluster.partitionCountForTopic(topic);
// return Math.abs(key.hashCode()) % numPartitions;
// // TODO: 2024/1/11 雪花id Long
//// return Math.abs(key.hashCode()) % numPartitions;
// }
//
// @Override
// public void close() {
//
// }
//
// @Override
// public void configure(Map<String, ?> map) {
//
// }
//}