Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot and Kafka: Broker disconnected

I have setup a Spring Boot application to receive Kafka messages from an existing and working Kafka producer. The setup is standard, and based on the following: https://www.codenotfound.com/spring-kafka-consumer-producer-example.html

Messages are not received, and the following is continually displayed in the console:

WARN org.apache.clients.NetworkClient :Bootstrap broker <hostname>:9092 disconnected 

In addition, the following debug message is logged:

org.apache.common.errors.Timeout: Failed to update metadata after 60000 ms.

The console message is discussed in the following link: https://community.hortonworks.com/content/supportkb/150148/errorwarn-bootstrap-broker-6668-disconnected-orgap.html

The logged message is discussed here: https://community.cloudera.com/t5/Data-Ingestion-Integration/Error-when-sending-message-to-topic-in-Kafka/td-p/41440

Very likely, the timeout will not happen when the first issue is resolved.

The solution to the console message which is given is to explicitly pass --security-protocol SSL as an argument to the producer or consumer command.

Given that I am listening on an existing Kafka broker and topic, no settings can be changed there. Any changes must be on the Spring Boot side.

Is it possible to configure application.yml so that --security-protocol SSL is passed an an argument to the consumer? Also, has anyone experienced this before, and is there another way to resolve the issue using the configuration options available in Spring Boot and Spring Kafka?

Thanks

like image 869
user1052610 Avatar asked Dec 20 '25 07:12

user1052610


1 Answers

See the documentation.

Scroll down to Kafka. Arbitrary Kafka properties can be set using

spring:
  kafka:
    properties:
      security.protocol: SSL

applies to consumer and producer (and admin in 2.0).

In the upcoming 2.0 release (currently RC1), there is also

spring:
  kafka:
    properties:
      consumer:
        some.property: foo

for properties that only apply to consumers (and similarly for producers and admins).

like image 198
Gary Russell Avatar answered Dec 22 '25 00:12

Gary Russell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!