feat: Add CredentialsProvider to Publisher and Subscriber settings#475
Conversation
These objects require more than one client and are annoying to construct correctly. Add a commonly needed setting to the top level here. Fixes #472
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
============================================
- Coverage 73.09% 72.67% -0.43%
- Complexity 835 840 +5
============================================
Files 151 151
Lines 4368 4374 +6
Branches 222 214 -8
============================================
- Hits 3193 3179 -14
- Misses 1056 1078 +22
+ Partials 119 117 -2 Continue to review full report at Codecov.
|
manuelmenzella-google
left a comment
There was a problem hiding this comment.
LGTM if my comment is addressed.
| <!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html --> | ||
| <differences> | ||
| <!-- Removed not needed API --> | ||
| <!-- Added abstract method to AutoValue.Builder class (Always okay) --> |
There was a problem hiding this comment.
Can you instead add a specific exclusion for what you are adding? Not all changes to Builders will be adding abstract methods. Will this trigger on removing methods?
There was a problem hiding this comment.
This specifically triggers on adding methods to nested classes named "Builder". I think thats specific enough. (code 7013 is added abstract method to abstract class)
There was a problem hiding this comment.
No, this isn't specific enough and would require a major version bump if this API had reached 1.0.
There was a problem hiding this comment.
I disagree. Addition of a method to a Builder class, which is only overridden in an autogenerated AutoValue file, would not trigger a major version bump as it is not a backwards-incompatible API surface change.
| <!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html --> | ||
| <differences> | ||
| <!-- Removed not needed API --> | ||
| <!-- Added abstract method to AutoValue.Builder class (Always okay) --> |
There was a problem hiding this comment.
No, this isn't specific enough and would require a major version bump if this API had reached 1.0.
Irrelevant to present library state. Possibly would be worth an out of band discussion, but dismissing to unblock a customer issue.
|
@dpcollins-google I'm thinking to upgrade google-cloud-pubsublite dependency in Apache Beam (Google Dataflow) from 0.7.0 to 0.13.2. It has breaking changes including this PR475 (compilation errors). Before I try to fix Beam's code, do you happen to know anyone working on Beam's pubsublite dependency upgrade already? |
| Committer wireCommitter = | ||
| CommitterSettings.newBuilder() | ||
| .setSubscriptionPath(subscriptionPath()) | ||
| .setPartition(partition) | ||
| .setServiceClient(newCursorServiceClient()) | ||
| .build() | ||
| .instantiate(); |
There was a problem hiding this comment.
Memo for myself. This seems the way to replace CommitterBuilder:
CommitterBuilder.Builder wireCommitterBuilder = CommitterBuilder.newBuilder();
wireCommitterBuilder.setSubscriptionPath(canonicalPath);
cursorServiceClientSupplier()
.ifPresent(supplier -> wireCommitterBuilder.setServiceClient(supplier.get()));
wireCommitterBuilder.setPartition(partition);
| SinglePartitionPublisherBuilder.Builder singlePartitionBuilder = | ||
| underlyingBuilder() | ||
| .setBatchingSettings(batchingSettings) | ||
| .setContext(PubsubContext.of(FRAMEWORK)) |
There was a problem hiding this comment.
Beam also touches this removed setContext method. Should it just remove the usage?
There was a problem hiding this comment.
This has been moved to newServiceClient method. (Thanks @dpcollins-google !)
|
|
||
| public PartitionCountWatchingPublisher(PartitionCountWatchingPublisherSettings settings) { | ||
| this.publisherFactory = settings.publisherFactory(); | ||
| this.policyFactory = settings.routingPolicyFactory(); | ||
| PartitionCountWatcher configWatcher = | ||
| settings.configWatcherFactory().newWatcher(this::handleConfig); | ||
| PartitionCountWatchingPublisher( | ||
| PartitionPublisherFactory publisherFactory, | ||
| RoutingPolicy.Factory policyFactory, | ||
| PartitionCountWatcher.Factory configWatcherFactory) { | ||
| this.publisherFactory = publisherFactory; | ||
| this.policyFactory = policyFactory; | ||
| PartitionCountWatcher configWatcher = configWatcherFactory.newWatcher(this::handleConfig); | ||
| addServices(configWatcher); | ||
| } |
There was a problem hiding this comment.
Memo for myself. This constructor is now invisible but used by Beam
https://github.com/apache/beam/blob/243128a8fc52798e1b58b0cf1a271d95ee7aa241/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/Publishers.java#L46
| PublisherServiceSettings.Builder settingsBuilder = PublisherServiceSettings.newBuilder(); | ||
| settingsBuilder = | ||
| addDefaultMetadata( | ||
| PubsubContext.of(FRAMEWORK), |
There was a problem hiding this comment.
Note for myself. This sets the context now.
These objects require more than one client and are annoying to construct correctly. Add a commonly needed setting to the top level here.
Fixes #472