googleapis / nodejs-pubsub

Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
https://cloud.google.com/pubsub/
Apache License 2.0
523 stars 227 forks source link

Add shutdown options for the client classes #1917

Open feywind opened 6 months ago

feywind commented 6 months ago

We are planning to add updates to the close() methods to allow for a more deterministic shutdown process. This will take care of issues like these:

https://github.com/googleapis/nodejs-pubsub/issues/1860 https://github.com/googleapis/nodejs-pubsub/issues/1856 https://github.com/googleapis/nodejs-pubsub/issues/1665 https://github.com/googleapis/nodejs-pubsub/issues/1648

The three options boil down to this:

modestaspruckus commented 1 month ago

Hey, any update on this, when it's planned to have proper close method?

mcasarrubios commented 1 week ago

Hi @feywind, is there a time estimate planned for this? This is something we need to be able to do a graceful shutdown. Thanks in advance

mcasarrubios commented 1 week ago

For us, the ideal solution would be this point ‘Wait for everything to finish dequeuing’.

feywind commented 6 days ago

@mcasarrubios Thanks for the input. Right now you can already do the basic "wait for dequeue" using these methods:

The extra thing we want to add is allowing options for how to handle outstanding data (e.g. drop everything on the floor and quit immediately).