We can receive all messages from Kafka by doing:
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
Is there a way to get only the last message ?
EDIT:
If you just want to keep track of some messages ( --max-messages 10 ) in your stream, a convenient command is:
watch -n5 "./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic auction --max-messages 10"
source share