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

SolaceIO: refactor to allow inheritance of BasicAuthSempClient #32400

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

bzablocki
Copy link
Contributor

@bzablocki bzablocki commented Sep 5, 2024

Users were not able to create a custom BasicAuthSempClient due to some package-private fields. This PR fixes that and adds example on how to create and use a custom client.

Depends on #32060, waiting for that to be merged


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

Copy link
Contributor

github-actions bot commented Sep 5, 2024

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@@ -52,7 +56,7 @@
* response is 401 Unauthorized, the client will execute an additional request with Basic Auth
* header to refresh the token.
*/
class SempBasicAuthClientExecutor implements Serializable {
public class SempBasicAuthClientExecutor implements Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

This class doesn't need to be serialized, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we leave it out for a separate PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine if this class isn't part of the public API, otherwise I'd fix it right now before users somehow introduce a dependency on the premise of serializability of this class.

Copy link
Contributor Author

@bzablocki bzablocki Nov 25, 2024

Choose a reason for hiding this comment

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

Removed, done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Edit, the tests are failing now. I think it has to be serializable, as this is a field in SempClient, which has to be serializable. I'll revert the changes

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack, LGTM then.

@@ -81,6 +87,15 @@ class SempBasicAuthClientExecutor implements Serializable {
COOKIE_MANAGER_MAP.putIfAbsent(this.cookieManagerKey, new CookieManager());
Copy link
Contributor

Choose a reason for hiding this comment

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

Not introduced by this PR, but this map may grow indefinitely. Also, this line unconditionally constructs a CookieManager. Could you change this to COOKIE_MANAGER_MAP.computeIfAbsent(this.cookieManagerKey, CookieManager::new) so it only constructs a new CookieManager when the key is absent?

Copy link
Contributor Author

@bzablocki bzablocki Nov 13, 2024

Choose a reason for hiding this comment

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

I'll change to COOKIE_MANAGER_MAP.computeIfAbsent(this.cookieManagerKey, CookieManager::new), thanks.

Regarding the unconditional growth - in theory yes, but in practice there won't be a big number of different combinations of baseUrls and usernames (CookieManagerKeys), so it won't grow beyond a few elements.

@bzablocki bzablocki closed this Nov 13, 2024
@bzablocki bzablocki force-pushed the multiple-semp-refactor-and-example branch from c009143 to c6a7354 Compare November 13, 2024 16:16
@bzablocki
Copy link
Contributor Author

Reopening after an error with rebase

@bzablocki bzablocki reopened this Nov 13, 2024
@bzablocki bzablocki force-pushed the multiple-semp-refactor-and-example branch from a3694d1 to eba116e Compare November 13, 2024 16:46
@bzablocki
Copy link
Contributor Author

Run Java PreCommit

@bzablocki bzablocki force-pushed the multiple-semp-refactor-and-example branch from c7a873c to a0a4d3d Compare November 25, 2024 14:01
@bzablocki
Copy link
Contributor Author

Run Java_Solace_IO_Direct PreCommit

@bzablocki
Copy link
Contributor Author

Run Java_Examples_Dataflow PreCommit

@bzablocki
Copy link
Contributor Author

@Abacn now that @sjvanrossum lgtm'ed, can I ask you for a review?

@Abacn Abacn merged commit 9560fe1 into apache:master Nov 27, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants