use of com.google.cloud.bigquery.storage.v1.stub.readrows.ReadRowsRetryingCallable 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());
}
use of com.google.cloud.bigquery.storage.v1.stub.readrows.ReadRowsRetryingCallable in project java-bigquerystorage by googleapis.
the class EnhancedBigQueryStorageStub method readRowsCallable.
public ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> readRowsCallable() {
ServerStreamingCallable<ReadRowsRequest, ReadRowsResponse> innerCallable = GrpcRawCallableFactory.createServerStreamingCallable(GrpcCallSettings.<ReadRowsRequest, ReadRowsResponse>newBuilder().setMethodDescriptor(BigQueryStorageGrpc.getReadRowsMethod()).setParamsExtractor(new RequestParamsExtractor<ReadRowsRequest>() {
@Override
public Map<String, String> extract(ReadRowsRequest request) {
return ImmutableMap.of("read_position.stream.name", String.valueOf(request.getReadPosition().getStream().getName()));
}
}).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());
}
use of com.google.cloud.bigquery.storage.v1.stub.readrows.ReadRowsRetryingCallable 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