Skip to content

Commit af98a13

Browse files
committed
pubsub: delete Subscriber.Builder::setCredentials
The credentials provided to this method is not used. Currently the credentials should be set in the ChannelProvider. Updates #1959.
1 parent 3beba47 commit af98a13

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

  • google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.google.api.gax.grpc.ChannelProvider;
2828
import com.google.api.gax.grpc.ExecutorProvider;
2929
import com.google.api.gax.grpc.InstantiatingExecutorProvider;
30-
import com.google.auth.Credentials;
3130
import com.google.auth.oauth2.GoogleCredentials;
3231
import com.google.common.annotations.VisibleForTesting;
3332
import com.google.common.base.Optional;
@@ -196,7 +195,8 @@ public FlowControlSettings getFlowControlSettings() {
196195
* Initiates service startup and returns immediately.
197196
*
198197
* <p>Example of receiving a specific number of messages.
199-
* <pre> {@code
198+
*
199+
* <pre>{@code
200200
* Subscriber subscriber = Subscriber.defaultBuilder(subscription, receiver).build();
201201
* subscriber.addListener(new Subscriber.Listener() {
202202
* public void failed(Subscriber.State from, Throwable failure) {
@@ -209,7 +209,6 @@ public FlowControlSettings getFlowControlSettings() {
209209
* done.get();
210210
* subscriber.stopAsync().awaitTerminated();
211211
* }</pre>
212-
*
213212
*/
214213
@Override
215214
public ApiService startAsync() {
@@ -450,7 +449,6 @@ public static final class Builder {
450449
.build();
451450

452451
SubscriptionName subscriptionName;
453-
Optional<Credentials> credentials = Optional.absent();
454452
MessageReceiver receiver;
455453

456454
Duration ackExpirationPadding = DEFAULT_ACK_EXPIRATION_PADDING;
@@ -471,16 +469,6 @@ public static final class Builder {
471469
this.receiver = receiver;
472470
}
473471

474-
/**
475-
* Credentials to authenticate with.
476-
*
477-
* <p>Must be properly scoped for accessing Cloud Pub/Sub APIs.
478-
*/
479-
public Builder setCredentials(Credentials credentials) {
480-
this.credentials = Optional.of(Preconditions.checkNotNull(credentials));
481-
return this;
482-
}
483-
484472
/**
485473
* {@code ChannelProvider} to use to create Channels, which must point at Cloud Pub/Sub
486474
* endpoint.
@@ -539,15 +527,15 @@ public Builder setExecutorProvider(ExecutorProvider executorProvider) {
539527
return this;
540528
}
541529

542-
/**
543-
* Gives the ability to set a custom executor for managing lease extensions. If none is
544-
* provided a shared one will be used by all {@link Subscriber} instances.
530+
/**
531+
* Gives the ability to set a custom executor for managing lease extensions. If none is provided
532+
* a shared one will be used by all {@link Subscriber} instances.
545533
*/
546534
public Builder setLeaseAlarmsExecutorProvider(ExecutorProvider executorProvider) {
547535
this.alarmsExecutorProvider = Preconditions.checkNotNull(executorProvider);
548536
return this;
549537
}
550-
538+
551539
/** Gives the ability to set a custom clock. */
552540
Builder setClock(ApiClock clock) {
553541
this.clock = Optional.of(clock);

0 commit comments

Comments
 (0)