megfigura opened a new issue #10488:
URL: https://github.com/apache/pulsar/issues/10488


   **Is your enhancement request related to a problem? Please describe.**
   The Reader interface has the ability to seek to an arbitrary timestamp, 
MessageId, first or last message in a topic, or to read the next message. 
However, there is no API to seek fowards/backwards from the current position in 
a topic.
   
   Ours I'm sure is not a common use-case, but you might imagine other 
situations where this could be useful. Ours is that we originally used Kafka 
for our pub/sub system and implemented cluster-wide logging via Kafka's 
Log4jAppender. We tried to implement the same thing using Pulsar, but we are 
unable to request the last _n_ logs because we can't seek backwards _n_ 
messages from the end of the topic. (Requesting logs from a particular 
timestamp onward was much easier to implement than in Kafka though!)
   
   **Describe the solution you'd like**
   Add a method to seek backwards (and forwards) from the current position by a 
number of messages.
   
   **Describe alternatives you've considered**
   I tried finding the last available MessageId and then manipulating the 
fields. Decrementing the MessageIdImpl.entryId seems to work, but only to the 
beginning of the ledger. I could also decrement the ledgerId, but I wouldn't 
know the Ledger's top entryId to start with. Plus, I'm not sure this is always 
a safe thing to do!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to