public class StreamObservers extends java.lang.Object
|Modifier and Type||Method and Description|
A utility method which sends acknowledgement to the client via the
Extracts a system error from the Throwable received on a client-side as a result of a failed gRPC call to server-side routines.
Creates a observer which does nothing upon the invocation of its callback methods.
public static <T> io.grpc.stub.StreamObserver<T> noOpObserver()
The callees which do not want to follow the responses should use this utility method to eliminate boilerplate code.
StreamObserverwhich does nothing
public static void ack(io.grpc.stub.StreamObserver<io.spine.core.Response> responseObserver)
responseObserverprovided and completes the response.
public static java.util.Optional<io.spine.base.Error> fromStreamError(java.lang.Throwable throwable)
Error is extracted from the trailer metadata of
If any other type of
Throwable is passed,
Optional.empty() is returned.
Throwableto extract an
Optional.empty()if the extraction failed