|
18 | 18 |
|
19 | 19 | import static com.google.common.base.MoreObjects.firstNonNull; |
20 | 20 |
|
| 21 | +import com.google.api.gax.core.ConnectionSettings; |
21 | 22 | import com.google.api.gax.core.RetrySettings; |
22 | 23 | import com.google.api.gax.grpc.ApiCallSettings; |
23 | 24 | import com.google.api.gax.grpc.ApiException; |
@@ -139,10 +140,20 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException { |
139 | 140 | subBuilder.provideChannelWith(channel, true); |
140 | 141 | } else { |
141 | 142 | GoogleCredentials credentials = options.authCredentials().credentials(); |
142 | | - pubBuilder.provideChannelWith( |
143 | | - credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES)); |
144 | | - subBuilder.provideChannelWith( |
145 | | - credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES)); |
| 143 | + ConnectionSettings pubConnectionSettings = ConnectionSettings.newBuilder() |
| 144 | + .setServiceAddress(options.host()) |
| 145 | + .setPort(PublisherSettings.DEFAULT_SERVICE_PORT) |
| 146 | + .provideCredentialsWith( |
| 147 | + credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES)) |
| 148 | + .build(); |
| 149 | + ConnectionSettings subConnectionSettings = ConnectionSettings.newBuilder() |
| 150 | + .setServiceAddress(options.host()) |
| 151 | + .setPort(SubscriberSettings.DEFAULT_SERVICE_PORT) |
| 152 | + .provideCredentialsWith( |
| 153 | + credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES)) |
| 154 | + .build(); |
| 155 | + pubBuilder.provideChannelWith(pubConnectionSettings); |
| 156 | + subBuilder.provideChannelWith(subConnectionSettings); |
146 | 157 | } |
147 | 158 | pubBuilder.applyToAllApiMethods(apiCallSettings(options)); |
148 | 159 | subBuilder.applyToAllApiMethods(apiCallSettings(options)); |
|
0 commit comments