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