/** * Create a bidirectional streaming callable object with grpc-specific functionality. Designed for * use by generated code. * * @param grpcCallSettings the gRPC call settings * @param streamingCallSettings {@link StreamingCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link BidiStreamingCallable} callable object. */ @BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { BidiStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectBidiStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); callable = new GrpcExceptionBidiStreamingCallable<>(callable, ImmutableSet.<StatusCode.Code>of()); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a client-streaming callable object with grpc-specific functionality. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param streamingCallSettings {@link StreamingCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link ClientStreamingCallable} callable object. */ @BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { ClientStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectClientStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); callable = new GrpcExceptionClientStreamingCallable<>(callable, ImmutableSet.<StatusCode.Code>of()); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a bidirectional streaming callable object with grpc-specific functionality. Designed for * use by generated code. * * @param grpcCallSettings the gRPC call settings * @param streamingCallSettings {@link StreamingCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link BidiStreamingCallable} callable object. */ @BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { BidiStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectBidiStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); callable = new GrpcExceptionBidiStreamingCallable<>(callable, ImmutableSet.<StatusCode.Code>of()); callable = new TracedBidiCallable<>( callable, clientContext.getTracerFactory(), getSpanName(grpcCallSettings.getMethodDescriptor())); return callable.withDefaultCallContext(clientContext.getDefaultCallContext()); }
/** * Create a client-streaming callable object with grpc-specific functionality. Designed for use by * generated code. * * @param grpcCallSettings the gRPC call settings * @param streamingCallSettings {@link StreamingCallSettings} to configure the method-level * settings with. * @param clientContext {@link ClientContext} to use to connect to the service. * @return {@link ClientStreamingCallable} callable object. */ @BetaApi("The surface for streaming is not stable yet and may change in the future.") public static <RequestT, ResponseT> ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { ClientStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectClientStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); callable = new GrpcExceptionClientStreamingCallable<>(callable, ImmutableSet.<StatusCode.Code>of()); 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()); }
/** * Create a Unary callable object with minimal grpc-specific functionality. * * @param grpcCallSettings the gRPC call settings * @param callSettings the Unary call settings * @param clientContext {@link ClientContext} to use to connect to the service. */ public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBaseUnaryCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, UnaryCallSettings<?, ?> callSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> callable = new GrpcDirectCallable<>(grpcCallSettings.getMethodDescriptor()); if (grpcCallSettings.getParamsExtractor() != null) { callable = new GrpcUnaryRequestParamCallable<>(callable, grpcCallSettings.getParamsExtractor()); } callable = new GrpcExceptionCallable<>(callable, callSettings.getRetryableCodes()); callable = Callables.retrying(callable, callSettings, clientContext); return callable; }
/** * Create a Unary callable object with minimal grpc-specific functionality. * * @param grpcCallSettings the gRPC call settings * @param callSettings the Unary call settings * @param clientContext {@link ClientContext} to use to connect to the service. */ public static <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBaseUnaryCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, UnaryCallSettings<?, ?> callSettings, ClientContext clientContext) { UnaryCallable<RequestT, ResponseT> callable = new GrpcDirectCallable<>(grpcCallSettings.getMethodDescriptor()); if (grpcCallSettings.getParamsExtractor() != null) { callable = new GrpcUnaryRequestParamCallable<>(callable, grpcCallSettings.getParamsExtractor()); } callable = new GrpcExceptionCallable<>(callable, callSettings.getRetryableCodes()); callable = Callables.retrying(callable, callSettings, clientContext); return callable; }
ClientContext clientContext) { ServerStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectServerStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); if (grpcCallSettings.getParamsExtractor() != null) { callable = callable, clientContext.getTracerFactory(), getSpanName(grpcCallSettings.getMethodDescriptor()));
/** * 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()); }
ClientContext clientContext) { ServerStreamingCallable<RequestT, ResponseT> callable = new GrpcDirectServerStreamingCallable<>(grpcCallSettings.getMethodDescriptor()); if (grpcCallSettings.getParamsExtractor() != null) { callable =