I know that the data can be read from kafka from a particular offset by using --offset in kafka-console-consumer, but this gives the records from that particular offset till the current offset. How can I limit it to one record only.
I know that the data can be read from kafka from a particular offset by using --offset in kafka-console-consumer, but this gives the records from that particular offset till the current offset. How can I limit it to one record only.
If you use the --help on the kafka-console-consumer command you can see:
--max-messages <Integer: num_messages> The maximum number of messages to
consume before exiting. If not set,
consumption is continual.
--offset <String: consume offset> The offset id to consume from (a non-
negative number), or 'earliest'
which means from beginning, or
'latest' which means from end
(default: latest)
--max-messages set to 1 is what you want