简体   繁体   中英

Spring Kafka Configuration for 2 different kafka cluster setups

In one of our spring-boot based services, we intended to connect to 2 different kafka clusters simultaneously. These clusters each have their own set of bootstrap-servers, topic configurations etc. They are nowhere related to each other as was the case in this question .

I will have different types messages to be read from each cluster on different topic names. There may or may not be multiple producers connecting to both the clusters from this service but we will surely have at least one consumer per cluster.

I would like to know how can I define properties in application.yml to cater to this setup so that I can just use 2 different KafkaProperties objects to create 4 container factories (2 consumer, 2 producer). The rest, I believe, should be pretty straight forward as I would need to use the relevant factory to create a particular container/listener/kafkaTemplate as per the business requirements.

You cannot; you need to disable Boot's auto configuration and configure the infrastructure beans for each cluster yourself.

Boot's auto configuration only supports one cluster.

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