Kafka Stream中的分区策略 [英] Partition Strategy in Kafka Stream
本文介绍了Kafka Stream中的分区策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Kafka流使用哪种分区策略?我们可以像在普通的Kafka Consumer中那样更改Kafka Stream中的分区策略吗?
Which partition strategy Kafka stream uses ? Can we change the partition strategy in Kafka Stream as we can change in normal Kafka Consumer
streamsConfiguration.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,Collections.singletonList(StickyAssignor.class));
没有区别,并且始终使用StreamsPartitionAssignor
makes no difference and always StreamsPartitionAssignor is used
推荐答案
否.您无法设置分区分配器.
No. You cannot set an partition assignor.
Kafka Streams对分区分配的工作方式有非常具体的要求,如果分配不正确,则可能会计算出错误的结果.因此,不允许设置自定义分区分配器.
Kafka Streams has very specific requirements how partition assignment works and if not done correctly, incorrect result could be computed. Thus, it's not allowed to set a custom partitions assignor.
这篇关于Kafka Stream中的分区策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文