|
24 | 24 | import com.google.api.gax.grpc.GaxGrpcProperties; |
25 | 25 | import com.google.api.gax.grpc.GrpcCallContext; |
26 | 26 | import com.google.api.gax.grpc.GrpcTransportChannel; |
| 27 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
27 | 28 | import com.google.api.gax.longrunning.OperationFuture; |
28 | 29 | import com.google.api.gax.rpc.ApiClientHeaderProvider; |
29 | 30 | import com.google.api.gax.rpc.FixedTransportChannelProvider; |
@@ -106,7 +107,8 @@ public class GapicSpannerRpc implements SpannerRpc { |
106 | 107 |
|
107 | 108 | private static final PathTemplate PROJECT_NAME_TEMPLATE = |
108 | 109 | PathTemplate.create("projects/{project}"); |
109 | | - |
| 110 | + private static final int MAX_MESSAGE_SIZE = 100 * 1024 * 1024; |
| 111 | + |
110 | 112 | private final SpannerStub stub; |
111 | 113 | private final InstanceAdminStub instanceStub; |
112 | 114 | private final DatabaseAdminStub databaseStub; |
@@ -143,17 +145,19 @@ public GapicSpannerRpc(SpannerOptions options) throws IOException { |
143 | 145 | mergedHeaderProvider.getHeaders(), |
144 | 146 | internalHeaderProviderBuilder.getResourceHeaderKey()); |
145 | 147 |
|
146 | | - // TODO(pongad): make channel pool work |
147 | | - |
148 | 148 | // TODO(pongad): make RPC logging work (formerly LoggingInterceptor) |
149 | 149 | // TODO(pongad): add watchdog |
150 | 150 | // TODO(pongad): make error augmentation work (formerly SpannerErrorInterceptor) |
151 | 151 |
|
| 152 | + // TODO(hzyi): make this channelProvider configurable through SpannerOptions |
152 | 153 | TransportChannelProvider channelProvider = |
153 | | - FixedTransportChannelProvider.create( |
154 | | - GrpcTransportChannel.newBuilder() |
155 | | - .setManagedChannel(options.getRpcChannels().get(0)) |
156 | | - .build()); |
| 154 | + InstantiatingGrpcChannelProvider |
| 155 | + .newBuilder() |
| 156 | + .setEndpoint(options.getEndpoint()) |
| 157 | + .setMaxInboundMessageSize(MAX_MESSAGE_SIZE) |
| 158 | + .setPoolSize(options.getNumChannels()) |
| 159 | + .build(); |
| 160 | + |
157 | 161 | CredentialsProvider credentialsProvider = |
158 | 162 | GrpcTransportOptions.setUpCredentialsProvider(options); |
159 | 163 |
|
|
0 commit comments