morganstanley / modern-cpp-kafka

A C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient)
Apache License 2.0
331 stars 86 forks source link

What is the earliest version of librdkafka that modern-cpp-kafka supports? #210

Closed sanjitk7 closed 1 year ago

sanjitk7 commented 1 year ago

I have a simple application that uses modern-cpp-kafka running on a Mac machine without issue (librdkafka version 2.1.1). I am now trying to deploy this application in a ubuntu VM (earliest available librdkafka version via dpkg is 1.8.0) and I see the following error which I assume is caused by a version mismatch between modern-cpp-kafka and librdkafka.

` In file included from include/kafka/KafkaProducer.h:6, from main.cpp:7: include/kafka/KafkaClient.h: In static member function ‘static rd_kafka_resp_err_t kafka::clients::KafkaClient::configInterceptorOnNew(rd_kafka_t, const rd_kafka_conf_t, void, char, std::size_t)’: include/kafka/KafkaClient.h:632:23: error: ‘rd_kafka_interceptor_add_on_broker_state_change’ was not declared in this scope; did you mean ‘rd_kafka_interceptor_add_on_request_sent’? 632 | if (auto result = rd_kafka_interceptor_add_on_broker_state_change(rk, "on_broker_state_change", KafkaClient::interceptorOnBrokerStateChange, opaque)) | ^~~~~~~~~~~ | rd_kafka_interceptor_add_on_request_sent make: *** [Makefile:10: all] Error 1

`

Can someone clarify the version that is expected by modern-cpp-kafka here?

kenneth-jia commented 1 year ago

Hi, @sanjitk7 As described in release notes, https://github.com/morganstanley/modern-cpp-kafka/releases/tag/v2023.03.07, the new code cooperates with librdkafka v2.0.2 (not compatible with librdkafka v1.x.x) You could try with https://github.com/morganstanley/modern-cpp-kafka/releases/tag/v2023.01.05, which is the last release supports librdkafka v1.x.x.

sanjitk7 commented 1 year ago

It actually was a version mismatch issue caused by the default (and latest) installation build with ubuntu dpkg gave me librdkafka 1.8.0 - installing the right rdkafka version from source solved the issue.