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 void
close()
default void
handle
(GrpcServiceContext ctx, Req request, BlockingStreamingGrpcServerResponse<Resp> response) Handles the passedGrpcRoutes.BlockingResponseStreamingRoute
.void
handle
(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.BlockingResponseStreamingRoute
instance 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 maintainFunctionalInterface
contract 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.BlockingResponseStreamingRoute
that implements both overloads instead of a lambda. Otherwise, the defaulthandle(GrpcServiceContext, Object, BlockingStreamingGrpcServerResponse)
implementation will be used.Handles the passedGrpcRoutes.BlockingResponseStreamingRoute
.- Parameters:
ctx
-GrpcServiceContext
for this call.request
-GrpcRoutes.BlockingResponseStreamingRoute
to handle.responseWriter
-GrpcPayloadWriter
to 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
-GrpcServiceContext
for this call.request
-GrpcRoutes.BlockingResponseStreamingRoute
to handle.response
-BlockingStreamingGrpcServerResponse
to 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:
close
in 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.BlockingResponseStreamingRoute
instance with a passed detached close implementation ofGracefulAutoCloseable
.Note: make sure to pass there an implementation of
GrpcRoutes.BlockingResponseStreamingRoute
that 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.BlockingResponseStreamingRoute
instance that has a detached close implementation.closeable
-GracefulAutoCloseable
implementation for the passedrawRoute
.- Returns:
- A new
GrpcRoutes.BlockingResponseStreamingRoute
that attaches the passedcloseable
to the passedrawRoute
.
-
handle(GrpcServiceContext, Object, BlockingStreamingGrpcServerResponse)
.