Creating a subscription with initial position as "earliest"
My use case: I have a shared subscription with a bunch of consumers. Suppose, all the consumers die and there are messages still being published to the topic. When a new consumer comes in, I want it to read from the last unacknowledged message so that no messages are lost or unprocessed.
So, I want to create a subscription with initial subscription position as earliest but I don't see any option to set the initial position. Also, What is default behavior? earliest or latest ?
Since subscription hold cursor(position of acked message) and cursor move forward when consumer send acknowledge, I think new consumer just reconnect your shared subscription.
More detail, please see below. https://pulsar.apache.org/docs/en/concepts-messaging/#shared
@equanz What if the topic had messages even before creating the subscription? I don't think subscription will read the old messages by default.
I see. In your use case, create new subscription when a new consumer comes in, right?
If so, I think new subscription use earliest position and don't process processed message by consumer side.
earliest can set initial subscription position to 'never deleted' message. However, 'never deleted' message is not always corresponding to unacked message correctly.
If you don't implement this process, I think you should reuse subscription.