GitHub user jak78 edited a comment on the discussion: Message unacknowlegment 
but i can not consume it

Hello @ThinhLe30, and welcome to the community! The behavior you're 
experiencing might be caused by the default setting of the initial subscription 
position as `Latest`. This setting means that the subscription will only 
deliver messages that are received after the subscription is created.

To modify this behavior, you can opt for the `Earliest` option in 
[SubscriptionInitialPosition](https://pkg.go.dev/github.com/apache/pulsar-client-go/pulsar#SubscriptionInitialPosition)
 within the `ConsumerOptions` when creating the consumer. By selecting 
Earliest, the subscription will instead deliver the oldest messages that have 
not yet been consumed, starting from the earliest available.

Feel free to try the following:

```go
consumer, err := client.Subscribe(pulsar.ConsumerOptions{
                        Topic:            "my-topic",
                        SubscriptionName: "my-sub",
                        Type:             pulsar.Shared,
                        SubscriptionInitialPosition: pulsar.Earliest,
                })
```

GitHub link: 
https://github.com/apache/pulsar/discussions/22059#discussioncomment-8495693

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

Reply via email to