-
Notifications
You must be signed in to change notification settings - Fork 160
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
What happens if exceptions are thrown in callbacks? #575
Comments
Hi @inad9300 - @SgtSilvio might know off hand as he's the original author. Do you have a test case? We could definitely document this better with our findings. |
I guess it depends what you mean by test case. This is basically the code I used for my experiment: .callback(__ -> {
System.out.println("Handling message..."); // Printed once and never again.
throw new RuntimeException("Error handling message.");
}) |
Encountered the same problem and would very much like this to be fixed. |
Hi @inad9300 @rod2j, the current requirement is to protect against exceptions in callbacks but this could be improved and definitely at least documented. I filed #624 to improve this behaviour based on your suggestions. If you have any other suggestions or ideas, feel free to add them into #624. I'll close this question issue for now. If anything else remains, let me know. |
I have a
Mqtt5AsyncClient
on which I callsubscribeWith()
,.callback()
, etc. My question is, what would happen if an exception is thrown by the consumer passed as callback? In my experiments, the consumer is never called again after such an event, so I would like to understand more in detail what happens internally in HiveMQ in case of exception, and what is the expectation from library users. I was quite surprised by this behavior to be honest – I was expecting HiveMQ to handle the exception in such a way that future calls to the callback kept working.The text was updated successfully, but these errors were encountered: