diff --git a/include/cppkafka/event.h b/include/cppkafka/event.h index a48175c..5fea261 100644 --- a/include/cppkafka/event.h +++ b/include/cppkafka/event.h @@ -121,12 +121,16 @@ public: */ void* get_opaque() const; +#if RD_KAFKA_VERSION >= RD_KAFKA_EVENT_STATS_SUPPORT_VERSION /** * \brief Gets the stats in this event * * This call is only valid if the event type is RD_KAFKA_EVENT_STATS */ - std::string get_stats() const; + std::string get_stats() const { + return rd_kafka_event_stats(handle_.get()); + } +#endif /** * \brief Gets the topic/partition for this event diff --git a/include/cppkafka/macros.h b/include/cppkafka/macros.h index 70c151a..460b414 100644 --- a/include/cppkafka/macros.h +++ b/include/cppkafka/macros.h @@ -48,5 +48,6 @@ #define RD_KAFKA_HEADERS_SUPPORT_VERSION 0x000b0402 //v0.11.4.02 #define RD_KAFKA_ADMIN_API_SUPPORT_VERSION 0x000b0500 //v0.11.5.00 #define RD_KAFKA_MESSAGE_LATENCY_SUPPORT_VERSION 0x000b0000 //v0.11.0.00 +#define RD_KAFKA_EVENT_STATS_SUPPORT_VERSION 0x000b0000 //v0.11.0.00 #endif // CPPKAFKA_MACROS_H diff --git a/src/event.cpp b/src/event.cpp index 1c82d3d..3fbc52f 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -73,10 +73,6 @@ void* Event::get_opaque() const { return rd_kafka_event_opaque(handle_.get()); } -string Event::get_stats() const { - return rd_kafka_event_stats(handle_.get()); -} - TopicPartition Event::get_topic_partition() const { using TopparHandle = unique_ptr;