Package io.servicetalk.grpc.api
Interface GrpcRoutes.BlockingStreamingRoute<Req,Resp>
- Type Parameters:
Req- Type of request.Resp- Type of response.
- All Superinterfaces:
AutoCloseable,GracefulAutoCloseable
- Enclosing class:
- GrpcRoutes<Service extends GrpcService>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
protected static interface GrpcRoutes.BlockingStreamingRoute<Req,Resp>
extends GracefulAutoCloseable
A blocking gRPC route with bi-directional streaming.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()default voidhandle(GrpcServiceContext ctx, BlockingIterable<Req> request, BlockingStreamingGrpcServerResponse<Resp> response) Handles the passedGrpcRoutes.BlockingStreamingRoute.voidhandle(GrpcServiceContext ctx, BlockingIterable<Req> request, GrpcPayloadWriter<Resp> responseWriter) Deprecated.static <Req,Resp> GrpcRoutes.BlockingStreamingRoute<Req, Resp> wrap(GrpcRoutes.BlockingStreamingRoute<Req, Resp> rawRoute, GracefulAutoCloseable closeable) Convenience method to wrap a rawGrpcRoutes.BlockingStreamingRouteinstance with a passed detached close implementation ofGracefulAutoCloseable.Methods inherited from interface io.servicetalk.concurrent.GracefulAutoCloseable
closeGracefully
-
Method Details
-
handle
@Deprecated void handle(GrpcServiceContext ctx, BlockingIterable<Req> request, GrpcPayloadWriter<Resp> responseWriter) throws Exception Deprecated.Usehandle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse). In the next release, this method will have a default implementation but the new overload won't. To avoid breaking API changes, make sure to implement both methods. The release after next will remove this method. This intermediate step is necessary to maintainFunctionalInterfacecontract that requires to have a single non-default method. Note: if you also usewrap(GrpcRoutes.BlockingStreamingRoute, GracefulAutoCloseable)method, make sure to pass there an implementation ofGrpcRoutes.BlockingStreamingRoutethat implements both overloads instead of a lambda. Otherwise, the defaulthandle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse)implementation will be used.Handles the passedGrpcRoutes.BlockingStreamingRoute.- Parameters:
ctx-GrpcServiceContextfor this call.request-BlockingIterableofGrpcRoutes.BlockingStreamingRouteto handle.responseWriter-GrpcPayloadWriterto write the response. The implementation of this method is responsible for callingCloseable.close().- Throws:
Exception- If an exception occurs during request processing.
-
handle
default void handle(GrpcServiceContext ctx, BlockingIterable<Req> request, BlockingStreamingGrpcServerResponse<Resp> response) throws Exception Handles the passedGrpcRoutes.BlockingStreamingRoute.- Parameters:
ctx-GrpcServiceContextfor this call.request-BlockingIterableofGrpcRoutes.BlockingStreamingRouteto handle.response-BlockingStreamingGrpcServerResponseto send the response. The implementation of this method is responsible for callingCloseable.close().- Throws:
Exception- If an exception occurs during request processing.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
wrap
static <Req,Resp> GrpcRoutes.BlockingStreamingRoute<Req,Resp> wrap(GrpcRoutes.BlockingStreamingRoute<Req, Resp> rawRoute, GracefulAutoCloseable closeable) Convenience method to wrap a rawGrpcRoutes.BlockingStreamingRouteinstance with a passed detached close implementation ofGracefulAutoCloseable.Note: make sure to pass there an implementation of
GrpcRoutes.BlockingStreamingRoutethat implements both overloads instead of a lambda. Otherwise, the defaulthandle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse)implementation will be used.- Type Parameters:
Req- Type of request.Resp- Type of response.- Parameters:
rawRoute-GrpcRoutes.BlockingStreamingRouteinstance that has a detached close implementation.closeable-GracefulAutoCloseableimplementation for the passedrawRoute.- Returns:
- A new
GrpcRoutes.BlockingStreamingRoutethat attaches the passedcloseableto the passedrawRoute.
-
handle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse).