use of com.google.api.gax.retrying.StreamingRetryAlgorithm in project java-bigquerystorage by googleapis.
the class EnhancedBigQueryReadStub method readRowsCallable.
public ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> readRowsCallable() {
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> innerCallable = GrpcRawCallableFactory.createServerStreamingCallable(GrpcCallSettings.<ReadRowsRequest, ReadRowsResponse>newBuilder().setMethodDescriptor(BigQueryReadGrpc.getReadRowsMethod()).setParamsExtractor(new RequestParamsExtractor<ReadRowsRequest>() {
@Override
public Map<String, String> extract(ReadRowsRequest request) {
return ImmutableMap.of("read_stream", String.valueOf(request.getReadStream()));
}
}).build(), stubSettings.readRowsSettings().getRetryableCodes());
ServerStreamingCallSettings<ReadRowsRequest, ReadRowsResponse> callSettings = stubSettings.readRowsSettings();
StreamingRetryAlgorithm<Void> retryAlgorithm = new StreamingRetryAlgorithm<>(new ApiResultRetryAlgorithm<Void>(readRowsRetryAttemptListener), new ExponentialRetryAlgorithm(callSettings.getRetrySettings(), context.getClock()));
ScheduledRetryingExecutor<Void> retryingExecutor = new ScheduledRetryingExecutor<>(retryAlgorithm, context.getExecutor());
if (context.getStreamWatchdog() != null) {
innerCallable = Callables.watched(innerCallable, callSettings, context);
}
ReadRowsRetryingCallable outerCallable = new ReadRowsRetryingCallable(context.getDefaultCallContext(), innerCallable, retryingExecutor, callSettings.getResumptionStrategy());
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> traced = new TracedServerStreamingCallable<>(outerCallable, context.getTracerFactory(), SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadRows"));
return traced.withDefaultCallContext(context.getDefaultCallContext());
}
Aggregations