GitHub user pulsar-community-bot added a comment to the discussion: Resetting 
Cursors

**From David K**

For the Key-shared subscription there is a different mechanism on the Broker 
side that tracks the assignment of the consumers on the subscription to a set 
of keys, e.g. a key-range. The cursor keeps track of the overall subscription 
position, while these key-ranges are used to route the message to the 
corresponding consumers based on their assigned key-range(s).

**From @sothmann**

In the example with consumers A and B, lets say consumer A gets key range A-J, 
consumer B gets key range K-Z assigned.
Now they will process messages in parallel, but each consumer processes the 
messages in its key range sequentially.
They can be at different positions in the topic as they work concurrently 
(especially if one consumer is faster than the other or if more messages come 
with keys in one of the two key ranges).
If there is a single cursor per subscription, what will it track in this case? 
What is the "overall subscription position"?
Sorry if this is a dumb question, but it hasn't really clicked for me yet.

**From David K**

For a non-partitioned topic, the cursor reset is the same as any other 
subscription type. It just moves the cursor to the message closest to the 
timestamp or messageId provided. Then as the Broker dispatches the messages it 
reads through the topic and “routes” the messages to the consumer based on the 
key.
[6:18](https://apache-pulsar.slack.com/archives/C5Z4T36F7/p1677259121064129)
For a partitioned topic, cursor management is bit more complicated, because we 
really need to manage multiple cursors inside a single subscription. This is 
all handled transparently from the consumers, but essentially there is one 
cursor per partition. When a reset occurs then all of these cursors are 
independently  moved to the message closest to the timestamp or messageId 
provided, and consumption resumes from there.

GitHub link: 
https://github.com/apache/pulsar/discussions/19634#discussioncomment-5102846

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to