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

Handle unexpected return values #39

Open
mmmries opened this issue Mar 26, 2022 · 1 comment
Open

Handle unexpected return values #39

mmmries opened this issue Mar 26, 2022 · 1 comment

Comments

@mmmries
Copy link
Owner

mmmries commented Mar 26, 2022

I noticed that we are using a very simple case statement to enforce the behaviour of the PullConsumer which means that if a user ever implements a function that has an unexpected return value it will crash their PullConsumer without sending back a NACK or any other indication to the jetstream server.

I think this type of thing could happen pretty easily by using a with statement in user code.

This seems like something we should handle by logging an error and potentially returning a NACK to jetstream, but we probably shouldn't just crash the whole PullConsumer?

@mkaput
Copy link
Collaborator

mkaput commented Mar 29, 2022

Returning something unexpected is a programmer error, and personally I would throw tantrums from our code in such case because it's contract violation.

I do agree that raising a more meaningful exception is a good thing here to do.

I am not sure if we should send NACK back because:

  1. a stream may be configured in NoAck mode for example
  2. not sending anything is also a Jetstream-recognizable behaviour (as far as I know, I may be wrong) and it means that consumer encountered an internal error -- which is exactly the thing that happens here

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