GithubHelp home page GithubHelp logo

Producer terminate about broadway_kafka HOT 5 CLOSED

dashbitco avatar dashbitco commented on July 22, 2024
Producer terminate

from broadway_kafka.

Comments (5)

josevalim avatar josevalim commented on July 22, 2024

When you terminate the supervisor, by calling Broadway.stop, all processes under it will terminate. You only need to trap exits if you want to execute some logic in the terminate callback, which we don't need in the producer stage. How are you stopping the pipeline?

from broadway_kafka.

FedericoPanS avatar FedericoPanS commented on July 22, 2024

I am stopping the pipeline in the way you mentioned. In the KafkaBroadway.Producer the group coordinator is disconnected in the terminate callback which is called from the terminate callback in the ProducerStage. This callback is not called and some brod processes keep running after stopping the pipeline.

from broadway_kafka.

josevalim avatar josevalim commented on July 22, 2024

Gotcha, so you are 100% correct. :) Would you like to send a PR to broadway_kafka? Then give it a try and let me know how it goes. I will move this issue there.

from broadway_kafka.

FedericoPanS avatar FedericoPanS commented on July 22, 2024

Thank you, I'll be happy to send a PR. Just to be sure, the way to go about it is to let each producer set the trap exit flag to true if they need to perform clean up in the terminate?
Also, is it possible to perform clean up in the processor? Right now I'm also sending to Kafka and would like to close the connection when the pipeline stops.
Thanks!

from broadway_kafka.

josevalim avatar josevalim commented on July 22, 2024

The fix is to call Process.flag(:trap_exit, true) in the producer init callback. That will set it for each producer.

Broadway shutdown is graceful, so all of the code in the processor, batchers, etc will push the remaning work before terminating. There is no additional clean up on processors and batch processors at the moment but we could support this feature in the Broadway topology if necessary (i.e. its own terminate callback).

from broadway_kafka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.