0

After setting up Kafka with Docker, I created a topic called 'my-topic' and tried to send and receive messages using a producer and consumer. However, I am unable to receive any messages. What could be the possible issue in this case? Topic retrieval is working fine. enter image description here

The message was sent as shown in the picture. But no message came.

I tried creating a consumer group, but I get a timeout exception.

Docker network is tied to ZooKeeper and Kafka.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
antidote
  • 1
  • 2

1 Answers1

0

no message came

Kafka Producers will batch data into one large request, and will not send each time you hit Enter key on console producer. You'll need to close the stream using Ctrl+D or Ctrl+C before the buffer is flushed.

Also, consumers default to read from the end of any topic (where there is no data until you produce data after starting the consumer) unless you use --from-beginning.

I see you're also using kafka:9092, which is not necessary when using docker exec; you can use localhost, as you did when listing the topics, but the port depends on other variables. Connect to Kafka running in Docker

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245