Cleanup bidi-stream from client that failed to start

25 views
Skip to first unread message

Joseph Vaughan

unread,
Jul 23, 2019, 9:51:24 AM7/23/19
to grpc.io
Hi all,

I'm working on some edge cases in an Android application. I have a bidi-stream which I'd like to clean up cleanly when it fails to start the RPC.

I'm triggering the RPC using the async stub, storing the resulting request stream and the passed in response stream. After some time period, I receive a call to onError() on the response stream, detailing that it could not connect with the Status code Unavailable.

At this point I'd like to be able to call the async stub again and receive a new stream. What should I do to ensure the previously failed stream is cleaned up? Should I call onError, or onClose of the request stream?

Appreciate any help,
Joe.

Joseph Vaughan

unread,
Jul 23, 2019, 9:53:18 AM7/23/19
to grpc.io
By onClose, I meant onCompleted.

Penn (Dapeng) Zhang

unread,
Aug 5, 2019, 7:37:15 PM8/5/19
to grpc.io
In response stream observer onError() callback, you implement the cleanup logic for your application. The failed stream is cleaned up by itself, don't call any method of request observer then.
Reply all
Reply to author
Forward
0 new messages