apache / pulsar-dotpulsar

The official .NET client library for Apache Pulsar
https://pulsar.apache.org/
Apache License 2.0
233 stars 60 forks source link

Reader/Consumer Messages #230

Open SultanaJon opened 2 weeks ago

SultanaJon commented 2 weeks ago

So, I am new to pulsar and I am running into some issues that are causing some confusion. I have setup a client, producer, consumer, and a reader. The client, producer, consumer, and reader all build with no error and seem to establish a connection when monitoring.

The first issue that I am having is that when I setup the reader, I request GetLastMessageIds. This will return me two MessageId's. The first with a topic that has 'partition-0` concatenated to the end and the second with 'partition-1' concatenated to the end of the topic. Once I read these, I then start to request the messages with the following code:

var messageIds = await reader.GetLastMessageIds();
await foreach(var message in reader.Messages(cts.Token))
{
    Console.WriteLine($"Read message");
}

When reading the messages, I can read the first message but once it attempts to read the second message, it hangs and the second message is never received. This is strange to me because GetLastMessageIds() told me there were two messages.

The second issue is with the consumer. Similar to the first issue, I can request the LastMessageIds but with the consumer, I cannot read the earliest messages. Attempting to get the messages from the consumer just hangs on the foreach and neither the first or last message are received.

  1. Why am I told there are two messages with GetLastMessageIds but I can only read one with the reader?
  2. Why can I not read any of the earliest messages with the consumer?
  3. Why does [reader/consumer].GetMessages() hang at some point?
entvex commented 2 weeks ago

Hi @SultanaJon,

Thanks for reaching out!

It sounds like you are using partitioned topics, is that correct?

To help us resolve the issue, could you please fill out the bug report template? Make sure to include a small sample of everything you do in DotPulsar to recreate the error.

Thanks!