Skip to content

Best Practice Question: Graceful exit consume loop #88

@destumme

Description

@destumme

This is more a question than a bug report or issue.

Using the node-rdkafka methods forked into this repo, what is the proper way to stop a consumer that has started flowing via registering an on('data') callback and beginning the consume loop with the consume() method (no params)? I am trying to achieve a graceful shutdown, so the consumer still needs to process and commit any messages still in memory, (processing one at a time, calling commitMessage at the end of processing).

Between, pause(), unassign(), and unsubscribe() I'm not really sure what the recommendation is here. Really I just need to stop the consume loop itself, not actually unassign or unsubscribe the consumer, as I still need to be able to commit the messages being worked on before I call disconnect on the consumer.

Put more plainly, given the consumer-flow.md example, what would be the recommended approach to implementing a graceful shutdown on the consumer (finishing all messages that have started processing) if that example program were to register an event listener for SIGINT

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionA question is asked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions