Giter Site home page Giter Site logo

Comments (2)

fsaintjacques avatar fsaintjacques commented on June 12, 2024

You can technically do it with librdkafka configuration mechanism (see https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). You'll have to define your own message/error callback in C, and probably pass your library with then LD_PRELOAD environment variable. After, all you have to do is call kafkacat with the -X dr_msg_cb=your_c_callback. This is not the most elegant way to do it, but you can wrap it in a shell script.

from kcat.

edenhill avatar edenhill commented on June 12, 2024

The above commit registers an error_cb to catch the ALL_BROKERS_DOWN error code from librdkafka, in which case kafkacat will exit.

This isn't perfect though since kafkacat is currently single-threaded and in producer mode it will block indefinately waiting for input on stdin (which there should typically be for a producer, so might not be a real problem).
Only when a message has been read from stdin will the error_cb be called.

The proper fix for this is for rdkafka to provide convenient auto-polling threads to alleviate this concern from simple programs, such as kafkacat.

from kcat.

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.