public final class ObservableReactiveUtil extends Object
Mono
, Flux
).Modifier and Type | Method and Description |
---|---|
static <ResponseT,RequestT,T> |
streamingBidirectionalCall(Function<io.grpc.stub.StreamObserver<ResponseT>,io.grpc.stub.StreamObserver<RequestT>> initialCall,
reactor.core.publisher.Flux<List<T>> inputs,
BiFunction<List<T>,ResponseT,RequestT> responseHandler)
Opens a bi-directional streaming call.
|
static <ResponseT> |
streamingCall(Consumer<io.grpc.stub.StreamObserver<ResponseT>> remoteCall)
Invokes a lambda that issues a streaming call and directs the response to a
Flux stream. |
static <ResponseT> |
unaryCall(Consumer<io.grpc.stub.StreamObserver<ResponseT>> remoteCall)
Invokes a lambda that in turn issues a remote call, directing the response to a
Mono stream. |
public static <ResponseT> reactor.core.publisher.Mono<ResponseT> unaryCall(Consumer<io.grpc.stub.StreamObserver<ResponseT>> remoteCall)
Mono
stream.ResponseT
- type of remote call responseremoteCall
- lambda capable of invoking the correct remote call, making use of the
Mono
-converting StreamObserver
implementation.Mono
containing the response of the unary call.public static <ResponseT> reactor.core.publisher.Flux<ResponseT> streamingCall(Consumer<io.grpc.stub.StreamObserver<ResponseT>> remoteCall)
Flux
stream.ResponseT
- response typeremoteCall
- call to makeFlux
of response objects resulting from the streaming call.public static <ResponseT,RequestT,T> reactor.core.publisher.Flux<T> streamingBidirectionalCall(Function<io.grpc.stub.StreamObserver<ResponseT>,io.grpc.stub.StreamObserver<RequestT>> initialCall, reactor.core.publisher.Flux<List<T>> inputs, BiFunction<List<T>,ResponseT,RequestT> responseHandler)
ResponseT
- type of objects streamed from the serverRequestT
- type of objects q streamed to the serverT
- type of input objects that will be wrapped in RequestT
initialCall
- opens a bidirectional gRPC connection with the provided StreamObserver
.inputs
- stream of objects to send to the serverresponseHandler
- processes responses streamed from the serverFlux
of server responsesCopyright © 2020 Pivotal Software, Inc.. All rights reserved.