简体   繁体   中英

Spring KafkaListener with topicPattern, assign all paritions of all topics

I have @KafkaListener using topicPattern with a regex which works just fine (foo.*), but now I want to assign the listener to all partitions of all matching topics.

The https://docs.spring.io/spring-kafka/docs/2.6.1/reference/html/#tip-assign-all-parts doesn't really help me as I don't know the topic names.

You can't manually assign partitions when using patterns; only group management (Kafka does the assignment) is supported for patterns.

If there is only one instance of your application, Kafka will assign all the partitions for matching topics. If there are multiple instances and you want them all assigned to all partitions, they must have unique group.id s.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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