简体   繁体   中英

Micronaut Kafka Listener multi topic

I want to create a KakfaListener for several topics. All topics start with "masterdata", for example:

  • masterdata.product
  • masterdata.supplier

I try to implement a topic pattern but it doesn't work:

@KafkaListener(offsetReset = OffsetReset.EARLIEST)
    static class AnalyticsListener {

        @Topic(patterns="masterdata*")
        void updateAnalytics(String item, String topic) {
            received.add(topic);
        }
    }

Any suggestion?

Your pattern matches masterdat , materdata , masetdataa , etc. The a* means zero or more a 's .

Try using masterdata\.[az]+

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