From a2e7f6db0dca9e371137a29ecc5956dd1f7568cd Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 25 Jun 2016 08:42:04 -0700 Subject: [PATCH] Add getters for Consumer callbacks --- include/cppkafka/consumer.h | 15 +++++++++++++++ src/consumer.cpp | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/cppkafka/consumer.h b/include/cppkafka/consumer.h index 8ad4b6d..8da9c76 100644 --- a/include/cppkafka/consumer.h +++ b/include/cppkafka/consumer.h @@ -282,6 +282,21 @@ public: */ std::string get_member_id() const; + /** + * Gets the partition assignment callback. + */ + const AssignmentCallback& get_assignment_callback() const; + + /** + * Gets the partition revocation callback. + */ + const RevocationCallback& get_revocation_callback() const; + + /** + * Gets the rebalance error callback. + */ + const RebalanceErrorCallback& get_rebalance_error_callback() const; + /** * \brief Polls for new messages * diff --git a/src/consumer.cpp b/src/consumer.cpp index a765116..3d1e2ab 100644 --- a/src/consumer.cpp +++ b/src/consumer.cpp @@ -180,6 +180,18 @@ string Consumer::get_member_id() const { return rd_kafka_memberid(get_handle()); } +const Consumer::AssignmentCallback& Consumer::get_assignment_callback() const { + return assignment_callback_; +} + +const Consumer::RevocationCallback& Consumer::get_revocation_callback() const { + return revocation_callback_; +} + +const Consumer::RebalanceErrorCallback& Consumer::get_rebalance_error_callback() const { + return rebalance_error_callback_; +} + Message Consumer::poll() { rd_kafka_message_t* message = rd_kafka_consumer_poll(get_handle(), get_timeout().count());