Nagihan Sevgi
Nagihan Sevgi

Reputation: 53

How can I add multiple kafka broker in spring boot application?

I have two kafka broker. I need to listen to both. How can I add both of them in my application.properties file?

test.kafka.bootstrapservers=Broker1:9092

Upvotes: 3

Views: 8968

Answers (2)

OneCricketeer
OneCricketeer

Reputation: 191854

If you have a valid Kafka cluster, then bootstrapping against only one will already cause you to consume from both.

Listing multiple bootstrap addresses is primarily for fault tolerance for the client and can be done with a comma-separated list

Upvotes: 2

nipuna
nipuna

Reputation: 4105

bootstrap-servers allows a comma-delimited list of host:port pairs to use for establishing the initial connections to the Kafka cluster.

You can add multiple Kafka nodes with a comma such as localhost:9092,localhost:9095.

For more information please refer here

Upvotes: 7

Related Questions