Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring-Boot and Kafka : How to handle broker not available?

While the spring-boot app is running and if I shutdown the broker completely ( both kafka and zookeeper ) I am seeing this warn in console for infinite amount of time.

[org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] WARN o.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-1, groupId=ResponseReceiveConsumerGroup] Connection to node 2147483647 could not be established. Broker may not be available.

Is there a way in Spring Boot to handle this gracefully instead of infinite logs on console ?

like image 648
lazydev Avatar asked Aug 10 '18 21:08

lazydev


1 Answers

Increase the reconnect.backoff.ms property (see Kafka docs).

The default is only 50ms.

like image 108
Gary Russell Avatar answered Sep 30 '22 03:09

Gary Russell