Skip to content

morgwai/grpc-utils

Repository files navigation

gRPC utils

Some helpful classes when developing gRPC services.
Copyright 2021 Piotr Morgwai Kotarbinski, Licensed under the Apache License, Version 2.0

latest release: 7.1 (javadoc)

MAIN USER CLASSES

Base class for inbound StreamObservers (server method request observers and client response observers), that pass results to some outboundObserver and may dispatch message processing to other threads. Handles all the synchronization and manual flow-control.

Streams messages to an outbound CallStreamObserver from multiple concurrent tasks with respect to flow-control. Useful when processing of 1 inbound message may result in multiple outbound messages that can be produced concurrently in multiple threads.

A ConcurrentInboundObserver that uses OrderedConcurrentOutputBuffer to ensure that outbound messages are sent in the order corresponding to the inbound messages order.

A ClientResponseObserver, that blocks until the response stream is completed with either onCompleted() or onError(error).

EXAMPLES

See sample app