Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Consumer Detection #30

Open
nevi-me opened this issue Aug 26, 2019 · 2 comments
Open

Slow Consumer Detection #30

nevi-me opened this issue Aug 26, 2019 · 2 comments

Comments

@nevi-me
Copy link

nevi-me commented Aug 26, 2019

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,

@o0Ignition0o
Copy link

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 ?

@nevi-me
Copy link
Author

nevi-me commented Aug 27, 2019

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 SlowConsumer notification, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants