/** * 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()); }
/** * Creates a callable object that represents a long-running operation. Designed for use by * generated code. * * @param innerCallable the callable that starts the operation * @param operationCallSettings {@link OperationCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @param longRunningClient {@link LongRunningClient} to use to poll for updates on the Operation. * @return {@link com.google.api.gax.rpc.OperationCallable} callable object. */ public static <RequestT, ResponseT, MetadataT> OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable( UnaryCallable<RequestT, OperationSnapshot> innerCallable, OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings, ClientContext clientContext, LongRunningClient longRunningClient) { UnaryCallable<RequestT, OperationSnapshot> initialCallable = createBaseUnaryCallable( innerCallable, operationCallSettings.getInitialCallSettings(), clientContext); OperationCallable<RequestT, ResponseT, MetadataT> operationCallable = Callables.longRunningOperation( initialCallable, operationCallSettings, clientContext, longRunningClient); return operationCallable.withDefaultCallContext(FakeCallContext.create(clientContext)); }