简体   繁体   English

Kafka Streams:我可以将我的处理器订阅到具有不同分区数量的多个主题吗

[英]Kafka Streams: Can I subscribe my processor to multiple topics with different number of partitions

I'm trying to create a Kafka Stream Topology with multiple processors that subscribe to a regex pattern and multiple topics as a result.我正在尝试创建一个 Kafka Stream 拓扑结构,其中包含多个订阅正则表达式模式和多个主题的处理器。

For example, pattern topic_(?:a|b|c) will connect to topic_a, topic_b, and topic_c.例如,模式topic_(?:a|b|c)将连接到 topic_a、topic_b 和 topic_c。 I have a different number of partitions for each topic, since they have different loads.我为每个主题设置了不同数量的分区,因为它们有不同的负载。 When running my topology, though, I see:但是,在运行我的拓扑时,我看到:

org.apache.kafka.streams.errors.TopologyException
...
Topics not co-partitioned

The difference between them are:它们之间的区别是:

topic_a: 3 partitions
topic_b: 3 partitions
topic_c: 30 partitions

Am I allowed to do this, or when subscribing to multiple topics I need to maintain the same number of partitions?我可以这样做吗,或者在订阅多个主题时我需要维护相同数量的分区?

Into further context, each of the topics listed above are actually two, like topic_a1 and topic_a2, topic_b1 and topic_b2.进一步来说,上面列出的每个主题实际上都是两个,如topic_a1和topic_a2,topic_b1和topic_b2。 They all got the same partition number and I'm trying to join, and later aggregate them using the streams API他们都有相同的分区号,我正在尝试加入,然后使用流 API 聚合它们

If an application is subscribed to multiple topics using a pattern, all of the topics need to have the same number of partitions.如果应用程序使用模式订阅多个主题,则所有主题都需要具有相同数量的分区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM