Slow Consumer Detection
Is there a way to configure what happens when the server sends a 'slow consumer' notification?
I've noticed that the subscription to a topic will remain active, even if there's no longer data coming. It would be ideal to throw an error so the loop gets broken,
Hi ! There seem to be two different questions, so I'll try to separate them:
Is there a way to configure what happens when the server sends a 'slow consumer' notification?
I don't think nitox provides a way to handle it for now. As the book seems to define it, I suppose the goal would be, once a slow consumer has been detected, to provide you with a callback so you can unsubscribe ?
I've noticed that the subscription to a topic will remain active, even if there's no longer data coming. It would be ideal to throw an error so the loop gets broken.
I might be wrong here, but I think it's a clients responsibility to subscribe or unsubscribe, so I'm not really sure it would be the lib's responsibility to provide you with it.
I suppose you would like to have it race with a tokio timeout ?
Hi and thanks for the response @o0Ignition0o
My initial observations were a bit incomplete, as I've subsequently noticed that:
- when the server sends a
SlowConsumernotification, it also closes the connection. - the client (and subscription) never reconnects nor terminates, so the subscription remains 'active' even though the connection is closed.
In my case, I stream the subscription, and can't think of a simple enough way to detect that the connection is closed, and thus terminate the loop.
The ideal solution (in my case) is for the stream to terminate with an error.
I'll have a look at the book, maybe it's simply a case of listening to the notification, and terminating the stream with a nitox::error::SlowConsumerError or equivalent. I'll try look into it this weekend, but would appreciate some guidance on where I can focus if possible.