Can anyone provide me a small example in spring boot kafka where we can consume multiple topics in one single listener class.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Dependency injection into Logback Appenders with S
- Deserialize duplicate keys to list using Jackson
- Serializing a serialized Thrift struct to Kafka in
- How can I access the repository from the entity in
相关文章
- How to load @Configuration classes from separate J
- Using Spring Dynamic Languages Support from Groovy
- Spring JMS : Set ErrorHandler for @JmsListener ann
- ModelMapper: Choose mapping based on Child class
- Configure Spring for CORS
- Remove transitive classpath dependency in gradle
- SpringBoot When file upload size limit exceeds get
- Can we add a feature module to an Angular app afte
For consumers part of consumer group you can use following:
@KafkaListener(topics = "topic1,") public void listen(@Payload KafkaBinding record, MessageHeaders headers) throws ExecutionException, InterruptedException { ……… ……….. }
For consumers acting as assign you can use following:
@KafkaListener(id = “foo”,topicPartitions = { @TopicPartition(topic = “myTopic”,partitions = { “1” })}) public void listen(@Payload KafkaBinding record, MessageHeaders headers) throws ExecutionException, InterruptedException { ……… ……….. }
application.yml
you listener:
or you can explore the
@ConfigurationProperties
and create the beans yourself, something like: