Skip to content

Added support for message status and setting the event mask #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/cppkafka/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ class CPPKAFKA_API Configuration : public ConfigurationBase<Configuration> {
* Sets the background event callback (invokes rd_kafka_conf_set_background_event_cb)
*/
Configuration& set_background_event_callback(BackgroundEventCallback callback);

/**
* Sets the event mask (invokes rd_kafka_conf_set_events)
*/
Configuration& set_events(int events);
#endif

/**
Expand Down
1 change: 1 addition & 0 deletions include/cppkafka/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
#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
#define RD_KAFKA_MESSAGE_STATUS_SUPPORT_VERSION 0x000b06ff //v0.11.6

#endif // CPPKAFKA_MACROS_H
7 changes: 7 additions & 0 deletions include/cppkafka/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ class CPPKAFKA_API Message {
}
#endif

#if (RD_KAFKA_VERSION >= RD_KAFKA_MESSAGE_STATUS_SUPPORT_VERSION)
rd_kafka_msg_status_t get_status() const {
assert(handle_);
return rd_kafka_message_status(handle_.get());
}
#endif

/**
* \brief Indicates whether this message is valid (not null)
*/
Expand Down
5 changes: 5 additions & 0 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ Configuration& Configuration::set_background_event_callback(BackgroundEventCallb
rd_kafka_conf_set_background_event_cb(handle_.get(), &background_event_callback_proxy);
return *this;
}

Configuration& Configuration::set_events(int events) {
rd_kafka_conf_set_events(handle_.get(), events);
return *this;
}
#endif

Configuration&
Expand Down