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

Favor unchecked over checked exceptions when sending messages #548

Closed
wants to merge 6 commits into from

Conversation

jonas-grgt
Copy link
Contributor

Should close #547

@onobc
Copy link
Collaborator

onobc commented Jan 20, 2024

Thanks for the contribution @jonasgeiregat ! I will review it sometime today.

Copy link
Collaborator

@onobc onobc left a comment

Choose a reason for hiding this comment

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

Great work @jonasgeiregat !

A couple of things to address:

  1. This is unrelated to your changes but when going through the code I noticed that Exception should instead be a RuntimeException at https://github.com/spring-projects/spring-pulsar/pull/548/files#diff-f89a2b123104d7393be862fb479fe66a23d2e03cce0efbc338f74c91c2e890ecR243. Do you mind adjusting? If not, I can handle during commit/merge.

  2. I made a suggested change around keeping the PulsarClientException.unwrap functionality.

  3. One area we will need to adjust is the PulsarOperations which still advertises the checked exceptions.

As you pointed out, the PulsarProducerFactory should be adjusted. The fun does not stop there, we also have PulsarConsumerFactory, and PulsarClientFactory. Lmk if you want to handle these as well in a subsequent PR. If you don't have the cycles I am more than happy to pick those up. Or, we could split them up, etc.. Just let me know.

Thanks

@jonas-grgt
Copy link
Contributor Author

Thanks for the feedback, I'll look into it tomorrow

Copy link
Collaborator

@onobc onobc left a comment

Choose a reason for hiding this comment

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

Awesome work @jonasgeiregat ! Thanks for also updating the other factories. I have made some final suggestions but I think after this round we will be good to merge.

Most of the suggestions are the same thing (once in each factory) and they center around the idea that the motivation of the change is to replace the checked PCEX w/ an unchecked version, our new PEX. I don't think we need to catch all when invoking a Pulsar client API, but rather just the PCEX and allow anything unexpected to bubble-up raw as it did before the change.

The one exception is for the PulsarTemplate.doSend because it calls the blocking .get which in turns throws the checked interuppted and execution exceptions and that is why the unwrap call there is helpful.

Again, great work.

@jonas-grgt
Copy link
Contributor Author

Processed your comments, sorry for the sloppy commit the other day.

@onobc
Copy link
Collaborator

onobc commented Jan 25, 2024

Processed your comments, sorry for the sloppy commit the other day.

No need to apologize. I did not find it sloppy. We appreciate your contributions. I will re-review sometime today and get this merged in.

@onobc
Copy link
Collaborator

onobc commented Jan 26, 2024

Thanks again for the great contribution! Nice job @jonasgeiregat

Closing in favor of 1126c46

@onobc onobc closed this Jan 26, 2024
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

Successfully merging this pull request may close these issues.

Removed checked exceptions from framework APIs
2 participants