Current state: Under Discussion
Discussion thread: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Currently, ConsoleConsumer does not allow a negative offset to support `tail -n` feature. However, it's convenient to quickly check the last N messages for a partition when debugging.
For better user experience, it would be nice to add `tail -n` capability for ConsoleConsumer.
Currently, three valid types of values for `offsets` option in ConsoleConsumer include:
- earliest (ignoring case): reading from the earliest offset
- latest (ignoring case): reading from the latest offset
- non-negative number: reading from the specified offset
To support `tail -n`, a fourth valid type of value is added:
- negative number (-N): reading from the "log end offset - N" offset. Take some for example, -1 means reading the last committed message; -2 means reading the last 2 messages and so on.
Similar to `tail -n`, the consumer will seek to the earliest offset if an extremely small negative value is specified.
Compatibility, Deprecation, and Migration Plan