Module: kamailio
Branch: master
Commit: fa92c728c10752824ef991d6828c1ddeea92fbe8
URL:
https://github.com/kamailio/kamailio/commit/fa92c728c10752824ef991d6828c1dd…
Author: Stefan Mititelu <stefan.mititelu(a)net2phone.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-09-18T10:01:10+02:00
kafka: Add brokers via librdkafka config object
This is because rd_kafka_brokers_add() is deprecated and will log a
CONFWARN message when kamailio starts.
---
Modified: src/modules/kafka/kfk.c
---
Diff:
https://github.com/kamailio/kamailio/commit/fa92c728c10752824ef991d6828c1dd…
Patch:
https://github.com/kamailio/kamailio/commit/fa92c728c10752824ef991d6828c1dd…
---
diff --git a/src/modules/kafka/kfk.c b/src/modules/kafka/kfk.c
index 7ac2b57f49c..b2999a7d721 100644
--- a/src/modules/kafka/kfk.c
+++ b/src/modules/kafka/kfk.c
@@ -240,6 +240,16 @@ int kfk_init(char *brokers)
*/
rk_conf = rd_kafka_conf_new();
+ /* Add brokers */
+ LM_DBG("Adding brokers: %s\n", brokers);
+ if(rd_kafka_conf_set(
+ rk_conf, "bootstrap.servers", brokers, errstr, sizeof(errstr))
+ != RD_KAFKA_CONF_OK) {
+ LM_ERR("No valid brokers specified: %s\n", brokers);
+ return -1;
+ }
+ LM_DBG("Added brokers: %s\n", brokers);
+
/* Set logger */
rd_kafka_conf_set_log_cb(rk_conf, kfk_logger);
@@ -267,14 +277,6 @@ int kfk_init(char *brokers)
rk_conf = NULL; /* Now owned by producer. */
LM_DBG("Producer handle created\n");
- LM_DBG("Adding broker: %s\n", brokers);
- /* Add brokers */
- if(rd_kafka_brokers_add(rk, brokers) == 0) {
- LM_ERR("No valid brokers specified: %s\n", brokers);
- return -1;
- }
- LM_DBG("Added broker: %s\n", brokers);
-
/* Topic creation and configuration. */
if(kfk_topic_list_configure()) {
LM_ERR("Failed to configure topics\n");