From 1f1f1c253b67a89f0f0900fddeb340b231d3e47d Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 27 Oct 2018 10:33:57 -0700 Subject: [PATCH] Fix build issue when using rd_kafka_message_latency in old rdkafka --- include/cppkafka/macros.h | 1 + include/cppkafka/message.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/cppkafka/macros.h b/include/cppkafka/macros.h index fb19dcc..70c151a 100644 --- a/include/cppkafka/macros.h +++ b/include/cppkafka/macros.h @@ -47,5 +47,6 @@ #define RD_KAFKA_QUEUE_REFCOUNT_BUG_VERSION 0x000b0500 //v0.11.5.00 #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 #endif // CPPKAFKA_MACROS_H diff --git a/include/cppkafka/message.h b/include/cppkafka/message.h index 252cb97..2d82d4b 100644 --- a/include/cppkafka/message.h +++ b/include/cppkafka/message.h @@ -177,6 +177,7 @@ public: */ boost::optional get_timestamp() const; +#if RD_KAFKA_VERSION >= RD_KAFKA_MESSAGE_LATENCY_SUPPORT_VERSION /** * \brief Gets the message latency in microseconds as measured from the produce() call. */ @@ -184,6 +185,7 @@ public: assert(handle_); return std::chrono::microseconds(rd_kafka_message_latency(handle_.get())); } +#endif /** * \brief Indicates whether this message is valid (not null)