Skip to content

fix: Fail the partition watcher if its consumer throws an exception - #728

Merged
dpcollins-google merged 1 commit into
masterfrom
palmere-consumer-failure
Jun 25, 2021
Merged

fix: Fail the partition watcher if its consumer throws an exception#728
dpcollins-google merged 1 commit into
masterfrom
palmere-consumer-failure

Conversation

@palmere-google

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

@palmere-google
palmere-google requested a review from a team June 23, 2021 18:58
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 23, 2021
@product-auto-label product-auto-label Bot added the api: pubsublite Issues related to the googleapis/java-pubsublite API. label Jun 23, 2021
@palmere-google
palmere-google force-pushed the palmere-consumer-failure branch from 75ff610 to 9b7c6f1 Compare June 23, 2021 19:02
@palmere-google
palmere-google force-pushed the palmere-consumer-failure branch from 9b7c6f1 to 8caa4fb Compare June 23, 2021 20:20
partitionCountReceiver.accept(partitionCount);
} catch (Throwable t) {
notifyFailed(ExtractStatus.toCanonical(t));
stop();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should notifyFailed eventually trigger stop() to be called? if so, remove this call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question, from the docs it seems like it doesn't

https://guava.dev/releases/23.0/api/docs/com/google/common/util/concurrent/AbstractService.html#notifyFailed-java.lang.Throwable-

"Invoke this method to transition the service to the Service.State.FAILED. The service will not be stopped if it is running. Invoke this method when a service has failed critically or otherwise cannot be started nor stopped."

@dpcollins-google
dpcollins-google merged commit c297c77 into master Jun 25, 2021
@dpcollins-google
dpcollins-google deleted the palmere-consumer-failure branch June 25, 2021 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsublite Issues related to the googleapis/java-pubsublite API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants