The Apache Kafka Streams documentation defines a co-partitioning requirement for KStream–KTable and KStream–KStream joins. Both input topics must have the same number of partitions and the same key partitioning strategy.
One valid solution is to use a GlobalKTable (Option A). A GlobalKTable is fully replicated to every Kafka Streams instance, removing the co-partitioning requirement. This approach is recommended when the reference data is relatively small and changes infrequently.
Another valid solution is to repartition one topic so that both topics have the same number of partitions (Option B). Kafka Streams provides repartition topics specifically for this purpose, allowing proper KStream–KTable joins.
Option C does not resolve the partition mismatch, as increasing instances does not change partitioning. Option D is incorrect because Kafka Streams does not automatically repartition both topics for joins; repartitioning must be explicitly configured.
Therefore, the correct and officially supported solutions are using a GlobalKTable and explicitly repartitioning one topic.
=========================
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit