Hi,

I am learning Apache Kafka and Spring Boot. I have a Kafka 4.0 broker
running locally and a Spring Boot application sending messages to a topic
javaguides.

*Below steps I followed:*

   1.

   Started Kafka broker on localhost:9092.
   2.

   Verified the topic exists:

.\bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 --list

Output: javaguides


3. Sent a message via Spring Boot:

http://localhost:8080/api/v1/kafka/publish?message=Hello Kafka

Spring Boot logs confirm the message is sent successfully.
4. Tried to consume messages using console consumer:

.\bin\windows\kafka-console-consumer.bat --bootstrap-server
localhost:9092 --topic javaguides --from-beginning

The console consumer starts but *does not display any messages*, even
though the topic has data.

*Kafka Version:* 4.0
*Spring Boot Version:* 3.x
*Spring Kafka Configuration:*

spring.kafka.consumer.bootstrap-servers=localhost:9092spring.kafka.consumer.group-id=mygroupspring.kafka.consumer.auto-offset-reset=earliestspring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializerspring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.producer.bootstrap-servers=localhost:9092spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializerspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer

*Notes:*

   -

   I have *not created a consumer class* in Spring Boot; I am relying on
   the console consumer to read messages.

*Questions:*

   1.

   Why does the console consumer not show messages sent by my Spring Boot
   producer?
   2.

   Is a Spring Boot KafkaConsumer class required for messages to appear in
   the console consumer?
   3.

   Are there any Kafka 4.0 configuration changes that could prevent the
   console consumer from receiving messages?

Any guidance would be greatly appreciated!

Thank you,
Kiran Kumar B O

Reply via email to