I get a fault message from Kafka that the message cannot be sent

Issue

This Content is from Stack Overflow. Question asked by torbjörn södheim

Description
I run Windows 10 and docker desktop. I execute all commands in DOS prompt or within the docker image, and I use the docker desktop app to start/stop/remove images.

Problem
When I try to send a random message to kafka I get an error message:

ERROR Error when sending message to topic test with key: null, value: 3 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0: 1503 ms has passed since batch creation plus linger time

How kafka image is created:

docker run -d --name kafka -p 9092:9092 -p 7203:7203 -e 
KAFKA_ZOOKEEPER_CONNECT=172.17.0.2:2181 -e 
kafka_advertised_host_name=localhost -e 
kafka_advertised_port=9092 
--env kafka_broker_id=1 
--env kafka_auto_create_topics_enable=true 
--env KAFKA_LISTENERS=PLAINTEXT://:9092 
--env kafka_advertised_listeners=PLAINTEXT://localhost:9092 
--env request_timeout_ms=20000 
artifactory.x.net/image

How a message is sent to kafka with a producer:

kafka-console-producer.sh -broker-list localhost:9092 -topic test

Question
What kind of fault can it be and how can I succeed to send a message too kafka? What is wrong?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?