Class BidirectionalMethodHandlerSupplier.BidiStreaming<ReqT,RespT>
java.lang.Object
io.helidon.microprofile.grpc.core.BidirectionalMethodHandlerSupplier.AbstractServerStreamingHandler<ReqT,RespT>
io.helidon.microprofile.grpc.core.BidirectionalMethodHandlerSupplier.BidiStreaming<ReqT,RespT>
- Type Parameters:
ReqT
- the request typeRespT
- the response type
- All Implemented Interfaces:
io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,
,RespT> io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,
,RespT> io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,
,RespT> io.grpc.stub.ServerCalls.UnaryMethod<ReqT,
,RespT> MethodHandler<ReqT,
RespT>
- Enclosing class:
BidirectionalMethodHandlerSupplier
public static class BidirectionalMethodHandlerSupplier.BidiStreaming<ReqT,RespT>
extends BidirectionalMethodHandlerSupplier.AbstractServerStreamingHandler<ReqT,RespT>
A bi-directional streaming
MethodHandler
that
calls a standard bi-directional streaming method handler method of the form.
StreamObserver<ReqT> invoke(StreamObserver<RespT> observer)
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.grpc.core.MethodHandler
MethodHandler.BidirectionalClient, MethodHandler.ClientStreaming, MethodHandler.ServerStreamingClient, MethodHandler.UnaryClient
-
Method Summary
Modifier and TypeMethodDescriptionbidirectional
(Object[] args, MethodHandler.BidirectionalClient client) Handle a bi-directional client call.protected Class
<?> getGenericResponseType
(Type type) Obtain the generic type of aType
Class
<?> Obtain the request type.Class
<?> Obtain the response type.protected Void
handleFuture
(RespT response, Throwable thrown, io.grpc.stub.StreamObserver<RespT> observer) Complete aStreamObserver
.io.grpc.stub.StreamObserver
<ReqT> protected io.grpc.stub.StreamObserver
<ReqT> Invoke the actual client streaming or bi-directional gRPC method handler.void
Obtain the name of the underlying Java method that this handler maps to.protected String
Obtain the gRPC method name.protected void
setRequestType
(Class<?> requestType) Set the request type to use if noGrpc.RequestType
annotation is present on the annotated method.protected void
setResponseType
(Class<?> responseType) Set the response type to use if noGrpc.ResponseType
annotation is present on the annotated method.final io.grpc.MethodDescriptor.MethodType
type()
Obtain thegRPC method tyoe
that thisMethodHandler
handles.Methods inherited from class io.helidon.microprofile.grpc.core.BidirectionalMethodHandlerSupplier.AbstractServerStreamingHandler
invoke
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.helidon.grpc.core.MethodHandler
clientOnly, clientStreaming, serverStreaming, unary
-
Method Details
-
invoke
protected io.grpc.stub.StreamObserver<ReqT> invoke(Method method, Object instance, io.grpc.stub.StreamObserver<RespT> observer) throws InvocationTargetException, IllegalAccessException Invoke the actual client streaming or bi-directional gRPC method handler.- Parameters:
method
- theMethod
to invokeinstance
- the service instance to invoke the method onobserver
- the method response observer- Returns:
- the
StreamObserver
to receive requests from the client - Throws:
InvocationTargetException
- if an error occurs invoking the methodIllegalAccessException
- if the method cannot be accessed
-
bidirectional
Description copied from interface:MethodHandler
Handle a bi-directional client call.- Parameters:
args
- the call arguments.client
- theMethodHandler.BidirectionalClient
instance to forward the call to.- Returns:
- the call result
-
type
public final io.grpc.MethodDescriptor.MethodType type()Description copied from interface:MethodHandler
Obtain thegRPC method tyoe
that thisMethodHandler
handles.- Specified by:
type
in interfaceMethodHandler<ReqT,
RespT> - Returns:
- the
gRPC method type
that thisMethodHandler
handles
-
invoke
- Specified by:
invoke
in interfaceMethodHandler<ReqT,
RespT> - Specified by:
invoke
in interfaceio.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,
RespT> - Specified by:
invoke
in interfaceio.grpc.stub.ServerCalls.UnaryMethod<ReqT,
RespT>
-
invoke
- Specified by:
invoke
in interfaceMethodHandler<ReqT,
RespT> - Specified by:
invoke
in interfaceio.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,
RespT> - Specified by:
invoke
in interfaceio.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,
RespT>
-
getRequestType
Description copied from interface:MethodHandler
Obtain the request type.- Specified by:
getRequestType
in interfaceMethodHandler<ReqT,
RespT> - Returns:
- the request type
-
setRequestType
Set the request type to use if noGrpc.RequestType
annotation is present on the annotated method.- Parameters:
requestType
- the request type
-
getResponseType
Description copied from interface:MethodHandler
Obtain the response type.- Specified by:
getResponseType
in interfaceMethodHandler<ReqT,
RespT> - Returns:
- the response type
-
javaMethodName
Description copied from interface:MethodHandler
Obtain the name of the underlying Java method that this handler maps to.- Specified by:
javaMethodName
in interfaceMethodHandler<ReqT,
RespT> - Returns:
- the name of the underlying Java method that this handler maps to
-
setResponseType
Set the response type to use if noGrpc.ResponseType
annotation is present on the annotated method.- Parameters:
responseType
- the response type
-
methodName
Obtain the gRPC method name.- Returns:
- the gRPC method name
-
handleFuture
protected Void handleFuture(RespT response, Throwable thrown, io.grpc.stub.StreamObserver<RespT> observer) Complete aStreamObserver
.- Parameters:
response
- the response valuethrown
- an error that may have occurredobserver
- theStreamObserver
to complete- Returns:
- always returns
Void
(i.e.null
)
-
getGenericResponseType
Obtain the generic type of aType
Typically used to obtain the generic type of a
StreamObserver
but could be used to obtain the generic type of other classes.If the type passed in is a
Class
then it has no generic component so the Object Class will be returned. Typically this would be due to a declaration such asStreamObserver observer
instead of a generic declaration such asStreamObserver<String> observer
.- Parameters:
type
- the type to obtain the generic type from- Returns:
- the generic type of a
Type
-