Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PubSubOptions extends GrpcServiceOptions<PubSub, PubSubRpc, PubSubO
private static final long serialVersionUID = 5640180400046623305L;
private static final String PUBSUB_SCOPE = "https://www.googleapis.com/auth/pubsub";
private static final Set<String> SCOPES = ImmutableSet.of(PUBSUB_SCOPE);
private static final String DEFAULT_HOST = "https://pubsub.googleapis.com";
private static final String DEFAULT_HOST = "pubsub.googleapis.com";

public static class DefaultPubSubFactory implements PubSubFactory {
private static final PubSubFactory INSTANCE = new DefaultPubSubFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.base.MoreObjects.firstNonNull;

import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ApiException;
Expand Down Expand Up @@ -139,10 +140,20 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException {
subBuilder.provideChannelWith(channel, true);
} else {
GoogleCredentials credentials = options.authCredentials().credentials();
pubBuilder.provideChannelWith(
credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES));
subBuilder.provideChannelWith(
credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES));
ConnectionSettings pubConnectionSettings = ConnectionSettings.newBuilder()
.setServiceAddress(options.host())
.setPort(PublisherSettings.DEFAULT_SERVICE_PORT)
.provideCredentialsWith(
credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES))
.build();
ConnectionSettings subConnectionSettings = ConnectionSettings.newBuilder()

This comment was marked as spam.

.setServiceAddress(options.host())
.setPort(SubscriberSettings.DEFAULT_SERVICE_PORT)
.provideCredentialsWith(
credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES))
.build();
pubBuilder.provideChannelWith(pubConnectionSettings);
subBuilder.provideChannelWith(subConnectionSettings);
}
pubBuilder.applyToAllApiMethods(apiCallSettings(options));
subBuilder.applyToAllApiMethods(apiCallSettings(options));
Expand Down