Determining topic data structure
Display messages to determine the data structure of the topic messages.
One way to determine the format of pre-existing data in Kafka is to run the command line consumer and look at what is in the topic.
Procedure
-
To show Apache Kafka messages:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 \ --from-beginning --property print.key=true --max-messages 5 \ --topic topic_name
-
To show Confluent Kafka messages:
- Messages other than
Avro:
bin/kafka-console-consumer --bootstrap-server localhost:9092 \ --from-beginning --property print.key=true --max-messages 5 \ --topic topic_name
- Avro
messages
bin/kafka-avro-console-consumer --bootstrap-server localhost:9092 \ --from-beginning --property print.key=true --max-messages 5 \ --topic topic_name
- Messages other than
Avro: