-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Pub/Sub Subscriber.stopAsync() is not asynchronous #3134
Copy link
Copy link
Closed
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
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.