apapia edited a comment on issue #468: URL: https://github.com/apache/pulsar-client-go/issues/468#issuecomment-1011514612
@flowchartsman I'm picking this up from @frankjkelly and trying to implement the Reader interface. However, I'm unsure how to implement it for our use case. Essentially, we just have a worker than wants to read a topic from the beginning to the "end" where the end is indicated by a message with an end-of-stream property. If this worker dies, the "job" will just be picked up by another worker which will start reading from the beginning of the stream. Now we need to handle reading the stream while a publisher is writing to it in real-time and we may also connect to the topic to read before the publisher does. What I'm unclear on is how to use the `reader.HasNext()` and `reader.Next(ctx)` interface. Under what conditions will `HasNext()` return false? Presumably any time there are no unread messages? If `HasNext()` returns false, what should the reader routine do? sleep for some amount of time? We want to read with as minimal latency as possible so we'd like to avoid unnecessary sleeps. With the Consumer interface, we were able to simply call `consumer.Receive(ctx)` and it would block until the next message was available. Is there a way to achieve that while using the Reader for a non-durable subscription? Thanks! -- 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. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org