Search code examples
apache-kafkakafka-consumer-apikafka-producer-api

How can i try to read to topic in kafka when i am getting an error as Missing required argument "[topic]"


I am getting an error while reading a topic from a single node cluster

kafka-console-producer.bat -- broker-list localhost:9092 -- topic raja

Error below

Missing required argument "[topic]"

kafka version-kafka_2.13-2.4.0


Solution

  • I suggest you do more research and training.

    You use kafka CONSUMER to read from a topic, NOT PRODUCER,
    and also, as @Robin Moffatt mentioned while I was typing the answer,
    remove spaces between the parameter labels:

    kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic raja
    

    This should work.

    If you want to read the topic from the beginning then add this as well:

    --from-beginning