Class ProxyServiceChannel
java.lang.Object
com.oracle.coherence.grpc.proxy.common.ProxyServiceChannel
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
public class ProxyServiceChannel
extends Object
implements io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
A bidirectional gRPC channel that handles requests for a gRPC proxy
and sends responses back down the channel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn async wrapper around aStreamObserver.protected classProxyServiceChannel.ForwardingStreamObserver<Resp extends com.google.protobuf.Message>AStreamObserverused to handle responses from theGrpcServiceProtocoland convert them to aProxyResponseto send down the channel. -
Constructor Summary
ConstructorsModifierConstructorDescriptionProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer) Create aProxyServiceChannel.protectedProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer, Supplier<Member> memberSupplier) Create aProxyServiceChannel. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAssert that this channel has received anInitRequest.protected io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest> Return an async wrapper around this channel.Return the serializer being used by the protocol.protected voidinit(long nId, com.oracle.coherence.grpc.messages.proxy.v1.InitRequest request) Initialise this channel.protected static Optional<GrpcServiceProtocol> loadProtocol(String sProtocol) Load the requestedGrpcServiceProtocol.voidvoidvoidonNext(com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest request) protected voidSend an error message down the channel.
-
Constructor Details
-
ProxyServiceChannel
public ProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer) Create aProxyServiceChannel.- Parameters:
service- the parentGrpcServiceobserver- theStreamObserverto send responses to
-
ProxyServiceChannel
protected ProxyServiceChannel(GrpcService service, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyResponse> observer, Supplier<Member> memberSupplier) Create aProxyServiceChannel.- Parameters:
service- the parentGrpcServiceobserver- theStreamObserverto send responses tomemberSupplier- aSupplierto supply the localMember
-
-
Method Details
-
onNext
public void onNext(com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest request) - Specified by:
onNextin interfaceio.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
-
onError
- Specified by:
onErrorin interfaceio.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
-
onCompleted
public void onCompleted()- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest>
-
getSerializer
Return the serializer being used by the protocol.- Returns:
- the serializer being used by the protocol
-
async
protected io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.messages.proxy.v1.ProxyRequest> async(Executor executor) Return an async wrapper around this channel.- Parameters:
executor- theExecutorto use to execute tasks- Returns:
- an async wrapper around this channel
-
init
protected void init(long nId, com.oracle.coherence.grpc.messages.proxy.v1.InitRequest request) Initialise this channel.- Parameters:
nId- the message id of the init requestrequest- theInitRequestto use for initialisation
-
assertInit
protected void assertInit()Assert that this channel has received anInitRequest.- Throws:
IllegalStateException- if this channel has not been initialized
-
sendError
Send an error message down the channel.- Parameters:
nId- the identifier of the request that the error corresponds tothrown- the error to send
-
loadProtocol
Load the requestedGrpcServiceProtocol.- Parameters:
sProtocol- the name of the protocol to load- Returns:
- the requested protocol, or an empty optional if the protocol cannot be loaded
-