Req - Type of request.Resp - Type of response.@FunctionalInterface
protected static interface GrpcRoutes.BlockingStreamingRoute<Req,Resp>
extends GracefulAutoCloseable
| Modifier and Type | Method and Description |
|---|---|
default void |
close() |
default void |
handle(GrpcServiceContext ctx,
BlockingIterable<Req> request,
BlockingStreamingGrpcServerResponse<Resp> response)
Handles the passed
Req. |
void |
handle(GrpcServiceContext ctx,
BlockingIterable<Req> request,
GrpcPayloadWriter<Resp> responseWriter)
Deprecated.
Use
handle(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 maintain FunctionalInterface contract that requires to have a
single non-default method.
Note: if you also use wrap(GrpcRoutes.BlockingStreamingRoute,
GracefulAutoCloseable) method, make sure to pass there an implementation of GrpcRoutes.BlockingStreamingRoute
that implements both overloads instead of a lambda. Otherwise, the default
handle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse) implementation
will be used. |
static <Req,Resp> GrpcRoutes.BlockingStreamingRoute<Req,Resp> |
wrap(GrpcRoutes.BlockingStreamingRoute<Req,Resp> rawRoute,
GracefulAutoCloseable closeable)
Convenience method to wrap a raw
GrpcRoutes.BlockingStreamingRoute instance with a passed detached close
implementation of GracefulAutoCloseable. |
@Deprecated void handle(GrpcServiceContext ctx, BlockingIterable<Req> request, GrpcPayloadWriter<Resp> responseWriter) throws Exception
handle(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 maintain FunctionalInterface contract that requires to have a
single non-default method.
Note: if you also use wrap(GrpcRoutes.BlockingStreamingRoute,
GracefulAutoCloseable) method, make sure to pass there an implementation of GrpcRoutes.BlockingStreamingRoute
that implements both overloads instead of a lambda. Otherwise, the default
handle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse) implementation
will be used.Req.ctx - GrpcServiceContext for this call.request - BlockingIterable of Req to handle.responseWriter - GrpcPayloadWriter to write the response.
The implementation of this method is responsible for calling Closeable.close().Exception - If an exception occurs during request processing.default void handle(GrpcServiceContext ctx, BlockingIterable<Req> request, BlockingStreamingGrpcServerResponse<Resp> response) throws Exception
Req.ctx - GrpcServiceContext for this call.request - BlockingIterable of Req to handle.response - BlockingStreamingGrpcServerResponse to send the response.
The implementation of this method is responsible for calling Closeable.close().Exception - If an exception occurs during request processing.default void close()
throws Exception
close in interface AutoCloseableExceptionstatic <Req,Resp> GrpcRoutes.BlockingStreamingRoute<Req,Resp> wrap(GrpcRoutes.BlockingStreamingRoute<Req,Resp> rawRoute, GracefulAutoCloseable closeable)
GrpcRoutes.BlockingStreamingRoute instance with a passed detached close
implementation of GracefulAutoCloseable.
Note: make sure to pass there an implementation of GrpcRoutes.BlockingStreamingRoute that implements both
overloads instead of a lambda. Otherwise, the default
handle(GrpcServiceContext, BlockingIterable, BlockingStreamingGrpcServerResponse) implementation
will be used.
Req - Type of request.Resp - Type of response.rawRoute - GrpcRoutes.BlockingStreamingRoute instance that has a detached close implementation.closeable - GracefulAutoCloseable implementation for the passed rawRoute.GrpcRoutes.BlockingStreamingRoute that attaches the passed closeable to the passed
rawRoute.