-
According to Apache Pulsar official document, it said that Here is my prob:
Both the code script following this library Apache Pulsar Go Client Library And when I first run the producer and follow the consumer, it doesn't consume any message even though i have produced it. I had to run the consumer first, then the producer, i received the message successfully. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 To modify this behavior, you can opt for the Feel free to try the following: consumer, err := client.Subscribe(pulsar.ConsumerOptions{
Topic: "my-topic",
SubscriptionName: "my-sub",
Type: pulsar.Shared,
SubscriptionInitialPosition: pulsar.Earliest,
}) |
Beta Was this translation helpful? Give feedback.
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 within theConsumerOptions
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: