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

How to check if brokers recovered from all down? #2629

Closed
1 of 7 tasks
BewareMyPower opened this issue Nov 19, 2019 · 2 comments
Closed
1 of 7 tasks

How to check if brokers recovered from all down? #2629

BewareMyPower opened this issue Nov 19, 2019 · 2 comments

Comments

@BewareMyPower
Copy link

Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ

Description

I'm maintaining a C++ kafka client sdk that wraps librdkafka, and it used rd_kafka_broker_any() (in rdkafka_broker.c) to check if there is any up broker.

Though it's an internal function, it's not a static function, so the sdk explicitly declared this function to call it.

I thought it's not a proper way, so I want to

  • use error_cb to check if brokers are all down by checking ERR__ALL_BROKERS_DOWN;
  • use stats_cb to parse json to find if exists some broker that broker[].state == UP.

Just like #1801.

But the previous maintainer thought it's too complicated to define a callback, parse json or just do some string operations in stats_cb, etc. And it seems not better than just call rd_kafka_broker_any(), except that rd_kafka_broker_destroy() (which is another internal function or macro) must be called to reduce refcnt.

Is there a simpler way to check if brokers recovered from all down ?

Additional, is there any needs to call rd_kafka_produce() to send message to the produce queue in dr_msg_cb when err == RD_KAFKA_ERR__MSG_TIMED_OUT? And if there is other error like ERR_LEADER_NOT_AVAILABLE in dr_msg_cb, and I call rd_kafka_produce() to enqueue the message again, will repeated message produced happen?

Appreciate you response and help.

Checklist

IMPORTANT: We will close issues where the checklist has not been completed.

Please provide the following information:

  • librdkafka version (release number or git tag): 1.0.1
  • Apache Kafka version: 1.1.0
  • librdkafka client configuration: <REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
  • Operating system: <REPLACE with e.g., Centos 5 (x64)>
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue
@DavidLiuXh
Copy link

@edenhill
Please help me to see this question. Thanks~

@edenhill
Copy link
Contributor

edenhill commented Apr 7, 2022

There's no support for calling librdkafka-internal functions, don't do it.

@edenhill edenhill closed this as completed Apr 7, 2022
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