Add compile guard for rd_kafka_event_stats

This commit is contained in:
Matias Fontanini
2018-10-27 10:43:58 -07:00
parent 1f1f1c253b
commit 25e3aacf4a
3 changed files with 6 additions and 5 deletions

View File

@@ -121,12 +121,16 @@ public:
*/ */
void* get_opaque() const; void* get_opaque() const;
#if RD_KAFKA_VERSION >= RD_KAFKA_EVENT_STATS_SUPPORT_VERSION
/** /**
* \brief Gets the stats in this event * \brief Gets the stats in this event
* *
* This call is only valid if the event type is RD_KAFKA_EVENT_STATS * 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 * \brief Gets the topic/partition for this event

View File

@@ -48,5 +48,6 @@
#define RD_KAFKA_HEADERS_SUPPORT_VERSION 0x000b0402 //v0.11.4.02 #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_ADMIN_API_SUPPORT_VERSION 0x000b0500 //v0.11.5.00
#define RD_KAFKA_MESSAGE_LATENCY_SUPPORT_VERSION 0x000b0000 //v0.11.0.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 #endif // CPPKAFKA_MACROS_H

View File

@@ -73,10 +73,6 @@ void* Event::get_opaque() const {
return rd_kafka_event_opaque(handle_.get()); 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 { TopicPartition Event::get_topic_partition() const {
using TopparHandle = unique_ptr<rd_kafka_topic_partition_t, using TopparHandle = unique_ptr<rd_kafka_topic_partition_t,
decltype(&rd_kafka_topic_partition_destroy)>; decltype(&rd_kafka_topic_partition_destroy)>;