The javadocs for Subscriber.stopAsync() (really from AbstractApiService) read:
... this initiates a service shutdown and returns immediately.
This does not seem to be how it is implemented in Pub/Sub. The doStop() calls into the MessageDispatcher.stop() then into the MessageWaiter.waitNoMessages(), etc..
Maybe the method name needs to be changed or the functionality updated? What I've had to do outside is to fork a thread that calls stopAsync(), dequeue messages from the receiver queues in other thread(s) so they can be nack'd in a ~spin loop, notice when the subscriber.state() gets to TERMINATED, and then join with the stopping thread.
A simple way to test this is to receive a message, don't ack or nack it reply-consumer, and the call stopAsync().
Maybe I am missing a configuration option or something? Thanks.
The javadocs for
Subscriber.stopAsync()(really fromAbstractApiService) read:This does not seem to be how it is implemented in Pub/Sub. The
doStop()calls into theMessageDispatcher.stop()then into theMessageWaiter.waitNoMessages(), etc..Maybe the method name needs to be changed or the functionality updated? What I've had to do outside is to fork a thread that calls
stopAsync(), dequeue messages from the receiver queues in other thread(s) so they can be nack'd in a ~spin loop, notice when thesubscriber.state()gets to TERMINATED, and then join with the stopping thread.A simple way to test this is to receive a message, don't ack or nack it reply-consumer, and the call
stopAsync().Maybe I am missing a configuration option or something? Thanks.