HiveMQ .net client timeout when subscribe to topic with existing messages

Hi all,

for a current project I am currently testing HiveMQtt .Net client.

If I connect with a new Client Id or to a topic without existing messages everything works fine and I will be notified if new messages are published.

But if I reconnect with the already used client id and in the topic to subscribe meanwhile messages was published, then I always running into an TimeoutException.

If this is the case, I do not receive the OnSubAckReceived event, but while SubscribeAsync is still running i receive at least on OnMessageReceived event.
And this seems to lead to some kind of deadlock.

If somebody has ideas how to resolve that, it would be appreciated.

Thanks in advance.
Sascha

Hello @sascha234 ,

Thank you for the outreach, and welcome to the HiveMQ Community!

Based on the symptoms noted here, it sounds like we may be running into an issue with a client not being ready to receive queued messages from a persistent session and the associated subscriptions.

From a functionality standpoint, if a client disconnects from a broker, and there is a persistent session active for that client, on reconnect, subscriptions from this persistent session is acknowledged and message delivery begins immediately for any queued messages for this client.

In order to dive in a bit deeper, it may be prudent to provide some of your implementation details. Additionally, with the .NET client, we do have some examples available that could be a great place to start when comparing client implementations.

Best,
Aaron from the HiveMQ Team