Package io.servicetalk.grpc.api
Interface GrpcRoutes.BlockingResponseStreamingRoute<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.BlockingResponseStreamingRoute<Req,Resp>
extends GracefulAutoCloseable
A blocking gRPC route with response streaming.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()default voidhandle(GrpcServiceContext ctx, Req request, BlockingStreamingGrpcServerResponse<Resp> response) Handles the passedGrpcRoutes.BlockingResponseStreamingRoute.voidhandle(GrpcServiceContext ctx, Req request, GrpcPayloadWriter<Resp> responseWriter) Deprecated.static <Req,Resp> GrpcRoutes.BlockingResponseStreamingRoute<Req, Resp> wrap(GrpcRoutes.BlockingResponseStreamingRoute<Req, Resp> rawRoute, GracefulAutoCloseable closeable) Convenience method to wrap a rawGrpcRoutes.BlockingResponseStreamingRouteinstance with a passed detached close implementation ofGracefulAutoCloseable.Methods inherited from interface io.servicetalk.concurrent.GracefulAutoCloseable
closeGracefully
-
Method Details
-
handle
@Deprecated void handle(GrpcServiceContext ctx, Req request, GrpcPayloadWriter<Resp> responseWriter) throws Exception Deprecated.Usehandle(GrpcServiceContext, Object, 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.BlockingResponseStreamingRoute, GracefulAutoCloseable)method, make sure to pass there an implementation ofGrpcRoutes.BlockingResponseStreamingRoutethat implements both overloads instead of a lambda. Otherwise, the defaulthandle(GrpcServiceContext, Object, BlockingStreamingGrpcServerResponse)implementation will be used.Handles the passedGrpcRoutes.BlockingResponseStreamingRoute.- Parameters:
ctx-GrpcServiceContextfor this call.request-GrpcRoutes.BlockingResponseStreamingRouteto 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, Req request, BlockingStreamingGrpcServerResponse<Resp> response) throws Exception Handles the passedGrpcRoutes.BlockingResponseStreamingRoute.- Parameters:
ctx-GrpcServiceContextfor this call.request-GrpcRoutes.BlockingResponseStreamingRouteto 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.BlockingResponseStreamingRoute<Req,Resp> wrap(GrpcRoutes.BlockingResponseStreamingRoute<Req, Resp> rawRoute, GracefulAutoCloseable closeable) Convenience method to wrap a rawGrpcRoutes.BlockingResponseStreamingRouteinstance with a passed detached close implementation ofGracefulAutoCloseable.Note: make sure to pass there an implementation of
GrpcRoutes.BlockingResponseStreamingRoutethat implements both overloads instead of a lambda. Otherwise, the defaulthandle(GrpcServiceContext, Object, BlockingStreamingGrpcServerResponse)implementation will be used.- Type Parameters:
Req- Type of request.Resp- Type of response.- Parameters:
rawRoute-GrpcRoutes.BlockingResponseStreamingRouteinstance that has a detached close implementation.closeable-GracefulAutoCloseableimplementation for the passedrawRoute.- Returns:
- A new
GrpcRoutes.BlockingResponseStreamingRoutethat attaches the passedcloseableto the passedrawRoute.
-
handle(GrpcServiceContext, Object, BlockingStreamingGrpcServerResponse).