pip/pip-435.md
startTimestamp and endTimestamp for consuming messages in client cliCurrently, if users consume messages from a topic using the Pulsar client CLI, they can't have an option to consume messages from a specific time. This PIP proposes to add startTimestamp and endTimestamp options to the Pulsar client CLI to allow users to consume messages within a specific time range.
Add startTimestamp and endTimestamp options to the client consume CLI.
Add startTimestamp and endTimestamp options in CmdConsume.
@Option(names = { "-stp", "--start-timestamp" }, description = "Start timestamp for consuming messages")
private long startTimestamp = 0L;
@Option(names = { "-etp", "--end-timestamp" }, description = "End timestamp for consuming messages")
private long endTimestamp = Long.MAX_VALUE;
Then use consumer.seek(startTimestamp) to consume the messages from the specified start timestamp, and check the publishTime of the received msg, if larger than the endTimestamp, stop the consume process.