Giter VIP home page Giter VIP logo

Comments (6)

edenhill avatar edenhill commented on May 8, 2024

That sounds like a reasonable thing, I will add it to the library.
Thanks.

from librdkafka.

winbatch avatar winbatch commented on May 8, 2024

Much appreciated. Note I just started with librdkafka, so expect more
questions and bug reports from me :)

On Fri, Dec 27, 2013 at 6:21 AM, Magnus Edenhill
[email protected]:

That sounds like a reasonable thing, I will add it to the library.
Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-31256971
.

from librdkafka.

edenhill avatar edenhill commented on May 8, 2024

I've verified that this already works as intended, but you need to call rd_kafka_poll() at regular intervals to let it call your error callback -(error_cb).

It will call the error callback with err set to RD_KAFKA_RESP_ERR__RESOLVE.

I.e.:
ERROR CALLBACK: rdkafka#consumer-0: Local: Host resolution failure: Failed to resolve 'false.edenhill.se:9092': Name or service not known

You can verify this behaviour with rdkafka_performance:
./rdkafka_performance -C -t topic -p 0 -b bad.host.name -I

from librdkafka.

winbatch avatar winbatch commented on May 8, 2024

Added a rd_kafka_poll() immediately after rd_kafka_brokers_add() and it worked perfectly. thanks! (Note, I had to do a poll with a timeout rather than -1 because when the broker list is good, the poll hangs. Not sure if this is expected or not).

from librdkafka.

edenhill avatar edenhill commented on May 8, 2024

The RESOLVE error callback will be triggered when the resolve fails, and depending on DNS configuration, network latency, resolver cache, etc, this may be anything from 1ms to 5 minutes, it really depends on the system setup.

Doing a poll(-1) means to wait forever, which is not what you want, and you cant really use a predefined timeout either for the above reasons.

I suggest that your application should assume that the provided brokers are correct, and if they are not and an error callback for RESOLVE is triggered, you handle the problem there, even if it is a bit late.

from librdkafka.

edenhill avatar edenhill commented on May 8, 2024

If you need to check that the brokers resolve you could resolve them yourself and provide them with numerical ip address to rd_kafka_brokers_add() or "metadata.broker.list" config property.

from librdkafka.

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.