Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully shutdown #136

Open
ht-jo opened this issue Oct 8, 2019 · 3 comments
Open

Gracefully shutdown #136

ht-jo opened this issue Oct 8, 2019 · 3 comments

Comments

@ht-jo
Copy link

ht-jo commented Oct 8, 2019

Hello.

I'm wondering of how to terminate a consumer gracefully, for instance, syncEvent is still running, but consumer.close() has called.

I couldn't find what waits for running tasks until finishing below code.

close(commit = false) {
this.haltAnalytics();
if (this.consumer) {
this._inClosing = true;
this._resume = false; //abort any running recursive consumption
if(!commit){
this.consumer.disconnect();
//this.consumer = null;
} else {
this.consumer.commit();
this.config.logger.info("Committing on close.");
process.nextTick(() => {
this.consumer.disconnect();
//this.consumer = null;
});
}
}
}

Is there any code of termination gracefully in rdkafka or something else? Or does it just let them terminate without graceful termination? or would I implement code that clean the resources before shutdown for myself?

Thank you!

@ht-jo ht-jo changed the title Gracefully termination Gracefully shutdown Oct 8, 2019
@Pruxis
Copy link

Pruxis commented Mar 13, 2020

@krystianity is this something you want to support in the driver itself? As currently we are holding promises in memory and use consumer.pause() to stop listening to message to then await all ongoing promises before gracefully shutting down our process.

@krystianity
Copy link
Member

Sorry for the late response.
I am not 100% certain, Blizzard/node-rdkafka#5 but it looks like node-rdkafka's dispatcher threads should take care of this automatically, as long as your application receives callbacks.

@krystianity
Copy link
Member

Since sinek uses the HighLevelProducer you should only make sure that your produce acknowledgement settings allow for acks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants