Kafka Stream 中的分区策略 [英] Partition Strategy in Kafka Stream

查看:42
本文介绍了Kafka Stream 中的分区策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kafka 流使用哪种分区策略?我们可以在Kafka Stream中更改分区策略,就像我们可以在普通Kafka Consumer中更改一样

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆