2
votes

I have two cluster setup cluster-1 at site 1(3 brokers) and cluster-2 at site 2(3 brokers) . Using spring kafka(1.3.6) consumer( one machine) and listening messages through @KafkaListener annotation . How do we instantiate multiple KafkaListenerContainerFactory for each cluster (c1 and c2) and listening data from both the cluster at the same time.

My listener should consume messages from both the cluster at the same time .

1

1 Answers

2
votes

Kafka will automatically connect to both instances, there is nothing more you need to do.

Simply add both addresses to the bootstrap.servers config so the client can connect even if one of the brokers is down (but partitions must be sufficiently replicated).