Search code examples
javaspring-bootapache-kafkaspring-kafkakafka-producer-api

How to push message to second kafka cluster topic if first cluster goes down using java


I have scenario where i need to push message into kafka topic using java....but condition is if my one cluster goes down then need to connect another kafka cluster and push the message.


Solution

  • You would need to configure two DefaultKafkaProducerFactory beans and two KafkaTemplates.

    When you get an exception, fail over to the other template.