Вопрос:

gRPC Java - Listening for successful calls on server

grpc grpc-java

191 просмотра

1 ответ

24 Репутация автора

I am looking for a way to capture when a call is completed on the server and no errors were thrown.

I understand that SimpleForwardingServerCallListener exists, however,onComplete is called when an exception is thrown.

My use case is for transaction management.

Автор: javajaba Источник Размещён: 08.11.2017 11:41

Ответы (1)


0 плюса

474 Репутация автора

Yes, it currently only triggers onComplete(). There is a bug filed for that. If it's fixed, you can probably get onCancel() instead.

For now, you can wrap the ServerCall with SimpleForwardingServerCall in your ServerInterceptor, and override close(). If the RPC ends successfully, OK will be passed to close().

Автор: Kun Zhang Размещён: 15.11.2017 07:00
Вопросы из категории :
32x32