kafka-spring-boot-example icon indicating copy to clipboard operation
kafka-spring-boot-example copied to clipboard

Consumer clients try to connect to localhost Kafka

Open dbeckers99 opened this issue 2 years ago • 1 comments

I build the project in IntelliJ (although all maven support is missing in the example) and changed the application.yml to set the parameter "bootstrap-servers" to my docker host IP with the running Kafka container.

Now I start the application (with ./mvnw spring-boot:run) and get a lot of error messages "[| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 (/127.0.0.1:9092) could not be established. Broker may not be available." until the process gives up for all 3 consumer clients.

How to fix this?

dbeckers99 avatar Jan 30 '23 08:01 dbeckers99

I solved myself: was a wrong KAFKA_ADVERTISED_HOST_NAME in docker-compose.yml of my docker/kafka. I used 127.0.0.1 but I have to use the IP of my docker host.

dbeckers99 avatar Jan 30 '23 08:01 dbeckers99