> > Thank you for your reply. > > When I run the command .\bin\windows\kafka-console-consumer.bat --topic > javaguides --from-beginning --bootstrap-server localhost:9092, the > consumers terminate immediately without waiting for producer messages. > > I have attached the server.log file. Could you please review it to see if > it is correct? >
PFA On Fri, 22 Aug 2025 at 13:11, Subra I <iamsubra...@gmail.com> wrote: > Not really familiar with KafkaTemplate. But your code looks right. > Maybe experts can comment more. > > Also, did u check server.log if it gives any clues? Increase log level if > needed to INFO/DEBUG. > > On Fri, Aug 22, 2025 at 2:42 AM Kiran Bo <kirankuma...@outlook.com> wrote: > > > Hi Team, > > Any updates > > ________________________________ > > From: Kiran Bo <kirankuma...@outlook.com> > > Sent: Wednesday, August 20, 2025 12:03 PM > > To: users@kafka.apache.org <users@kafka.apache.org> > > Subject: Kafka 4.0 Console Consumer Not Receiving Messages From Spring > > Boot Producer > > > > Hi Kafka Team, > > I am learning Apache Kafka in 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:9092 > > spring.kafka.consumer.group-id=mygroup > > spring.kafka.consumer.auto-offset-reset=earliest > > > > > spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer > > > > > spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer > > > > spring.kafka.producer.bootstrap-servers=localhost:9092 > > > > > spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer > > > > > spring.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 > > > > >