/** * Create a paged callable object that represents a paged API method. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param pagedCallSettings {@link PagedCallSettings} to configure the paged settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link UnaryCallable} callable object. */ public static <RequestT, ResponseT, PagedListResponseT> UnaryCallable<RequestT, PagedListResponseT> createPagedCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> innerCallable = createBaseUnaryCallable(grpcCallSettings, pagedCallSettings, clientContext); UnaryCallable<RequestT, PagedListResponseT> pagedCallable = Callables.paged(innerCallable, pagedCallSettings); return pagedCallable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a paged callable object that represents a paged API method. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param pagedCallSettings {@link PagedCallSettings} to configure the paged settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link UnaryCallable} callable object. */ public static <RequestT, ResponseT, PagedListResponseT> UnaryCallable<RequestT, PagedListResponseT> createPagedCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> innerCallable = createBaseUnaryCallable(grpcCallSettings, pagedCallSettings, clientContext); UnaryCallable<RequestT, PagedListResponseT> pagedCallable = Callables.paged(innerCallable, pagedCallSettings); return pagedCallable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a callable object that represents a batching API method. Designed for use by generated * code. * * @param grpcCallSettings the gRPC call settings * @param batchingCallSettings {@link BatchingCallSettings} to configure the batching related * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link UnaryCallable} callable object. */ @BetaApi("The surface for batching is not stable yet and may change in the future.") public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, BatchingCallSettings<RequestT, ResponseT> batchingCallSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> callable = createBaseUnaryCallable(grpcCallSettings, batchingCallSettings, clientContext); callable = Callables.batching(callable, batchingCallSettings, clientContext); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a callable object with grpc-specific functionality. Designed for use by generated code. * * @param grpcCallSettings the gRPC call settings */ public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, UnaryCallSettings<RequestT, ResponseT> callSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> callable = createBaseUnaryCallable(grpcCallSettings, callSettings, clientContext); callable = new TracedUnaryCallable<>( callable, clientContext.getTracerFactory(), getSpanName(grpcCallSettings.getMethodDescriptor())); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a callable object with grpc-specific functionality. Designed for use by generated code. * * @param grpcCallSettings the gRPC call settings */ public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, UnaryCallSettings<RequestT, ResponseT> callSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> callable = createBaseUnaryCallable(grpcCallSettings, callSettings, clientContext); callable = new TracedUnaryCallable<>( callable, clientContext.getTracerFactory(), getSpanName(grpcCallSettings.getMethodDescriptor())); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Creates a callable object that represents a long-running operation. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param operationCallSettings {@link OperationCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @param operationsStub {@link OperationsStub} to use to poll for updates on the Operation. * @return {@link com.google.api.gax.rpc.OperationCallable} callable object. */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public static <RequestT, ResponseT, MetadataT> OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable( GrpcCallSettings<RequestT, Operation> grpcCallSettings, OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings, ClientContext clientContext, OperationsStub operationsStub) { UnaryCallable<RequestT, Operation> initialGrpcCallable = createBaseUnaryCallable( grpcCallSettings, operationCallSettings.getInitialCallSettings(), clientContext); UnaryCallable<RequestT, OperationSnapshot> initialCallable = new GrpcOperationSnapshotCallable<>(initialGrpcCallable); LongRunningClient longRunningClient = new GrpcLongRunningClient(operationsStub); OperationCallable<RequestT, ResponseT, MetadataT> operationCallable = Callables.longRunningOperation( initialCallable, operationCallSettings, clientContext, longRunningClient); return operationCallable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Creates a callable object that represents a long-running operation. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param operationCallSettings {@link OperationCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @param operationsStub {@link OperationsStub} to use to poll for updates on the Operation. * @return {@link com.google.api.gax.rpc.OperationCallable} callable object. */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public static <RequestT, ResponseT, MetadataT> OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable( GrpcCallSettings<RequestT, Operation> grpcCallSettings, OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings, ClientContext clientContext, OperationsStub operationsStub) { UnaryCallable<RequestT, Operation> initialGrpcCallable = createBaseUnaryCallable( grpcCallSettings, operationCallSettings.getInitialCallSettings(), clientContext); UnaryCallable<RequestT, OperationSnapshot> initialCallable = new GrpcOperationSnapshotCallable<>(initialGrpcCallable); LongRunningClient longRunningClient = new GrpcLongRunningClient(operationsStub); OperationCallable<RequestT, ResponseT, MetadataT> operationCallable = Callables.longRunningOperation( initialCallable, operationCallSettings, clientContext, longRunningClient); return operationCallable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a callable object that represents a batching API method. Designed for use by generated * code. * * @param grpcCallSettings the gRPC call settings * @param batchingCallSettings {@link BatchingCallSettings} to configure the batching related * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link UnaryCallable} callable object. */ @BetaApi("The surface for batching is not stable yet and may change in the future.") public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, BatchingCallSettings<RequestT, ResponseT> batchingCallSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> baseCallable = createBaseUnaryCallable(grpcCallSettings, batchingCallSettings, clientContext); // NOTE: Since batching happens asynchronously and the outermost callable simply buffers the // request. Tracing will only start on the inner callable that accepts the batch. UnaryCallable<RequestT, ResponseT> tracedCallable = new TracedBatchingCallable<>( baseCallable, clientContext.getTracerFactory(), getSpanName(grpcCallSettings.getMethodDescriptor()), batchingCallSettings.getBatchingDescriptor()); UnaryCallable<RequestT, ResponseT> batchingCallable = Callables.batching(tracedCallable, batchingCallSettings, clientContext); return batchingCallable.withDefaultCallContext(clientContext.getDefaultCallContext()); }