kafka-spring-boot-example
kafka-spring-boot-example copied to clipboard
Consumer clients try to connect to localhost Kafka
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?
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.