英文:
how to create kafka listeners and add them dynamically in spring context
问题
你好,我正在开发一个Groovy DSL,它允许使用Spring Boot动态创建Kafka消费者。例如,我可以编写以下代码:
consumer("topic1", "group_id_1") {
//
}
consumer("topic2", "group_id_2") {
//
}
从这段代码中,我可以动态地创建两个Kafka消费者。一个消费者订阅主题"topic1",使用组ID "group_id_1",另一个消费者订阅主题"topic2",使用组ID "group_id_2"。然后将这两个消费者添加到Spring应用程序的上下文中。
英文:
hello i am developing a groovy dsl which allows to dynamically create kafka consumers with spring boot, exmple i can write.
consumer("topic1","group_id_1"){
//
}
consumer("topic2","group_id_2"){
//
}
and from this code I dynamically create two consumers kafka, consumer towards the topic "topic1" with a group id "group_id_1" and consumer towards the topic "topic 2" and with a group id "group_id_2" and add these two consumers in spring context application.
专注分享java语言的经验与见解,让所有开发者获益!
评论