Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to multiple clusters spring kafka

I would like to consume messages from one kafka cluster and publish to another kafka cluster. Would like to know how to configure this using spring-kafka?

like image 288
Kushboo Jain Avatar asked Oct 24 '25 14:10

Kushboo Jain


1 Answers

Simply configure the consumer and producer factories with different bootstrap.servers properties.

If you are using Spring Boot, see

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#spring.kafka.consumer.bootstrap-servers

and

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#spring.kafka.producer.bootstrap-servers

If you are creating your own factory @Beans, set the properties there.

https://docs.spring.io/spring-kafka/docs/current/reference/html/#connecting

like image 85
Gary Russell Avatar answered Oct 27 '25 04:10

Gary Russell