mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-02 03:28:01 +00:00
Minor documentation improvements
This commit is contained in:
@@ -79,17 +79,17 @@ class TopicConfiguration;
|
|||||||
* consumer.subscribe({ "my_topic" });
|
* consumer.subscribe({ "my_topic" });
|
||||||
* while (true) {
|
* while (true) {
|
||||||
* // Poll. This will optionally return a message. It's necessary to check if it's a valid
|
* // Poll. This will optionally return a message. It's necessary to check if it's a valid
|
||||||
* // one before using it or bad things will happen
|
* // one before using it
|
||||||
* Message msg = consumer.poll();
|
* Message msg = consumer.poll();
|
||||||
* if (msg) {
|
* if (msg) {
|
||||||
* // It's a valid message!
|
|
||||||
* if (!msg.get_error()) {
|
* if (!msg.get_error()) {
|
||||||
* // It's an actual message. Get the payload and print it to stdout
|
* // It's an actual message. Get the payload and print it to stdout
|
||||||
* cout << msg.get_payload().as_string() << endl;
|
* cout << msg.get_payload().as_string() << endl;
|
||||||
* }
|
* }
|
||||||
* else {
|
* else if (!msg.is_eof()) {
|
||||||
* // Is it an error notification
|
* // Is it an error notification, handle it.
|
||||||
* // ...
|
* // This is explicitly skipping EOF notifications as they're not actually errors,
|
||||||
|
* // but that's how rdkafka provides them
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class MessageTimestamp;
|
|||||||
*
|
*
|
||||||
* This is a non copyable, movable class that wraps a rd_kafka_message_t*.
|
* This is a non copyable, movable class that wraps a rd_kafka_message_t*.
|
||||||
*
|
*
|
||||||
* Messages can be empty (contain a null rd_kafka_message_t*). Therefore, users should check
|
* Messages can be empty (contain a null rd_kafka_message_t*). Therefore, users must check
|
||||||
* that the message isn't empty by using the operator bool() before using them. This is especially
|
* that the message isn't empty by using the operator bool() before using them. This is especially
|
||||||
* necessary when calling Consumer::poll() as any poll operation that returns a null pointer will
|
* necessary when calling Consumer::poll() as any poll operation that returns a null pointer will
|
||||||
* return an empty message.
|
* return an empty message.
|
||||||
@@ -151,6 +151,9 @@ private:
|
|||||||
Buffer key_;
|
Buffer key_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a message's timestamp
|
||||||
|
*/
|
||||||
class CPPKAFKA_API MessageTimestamp {
|
class CPPKAFKA_API MessageTimestamp {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class TopicConfiguration;
|
|||||||
* Producer producer(config);
|
* Producer producer(config);
|
||||||
*
|
*
|
||||||
* // Create some key and payload
|
* // Create some key and payload
|
||||||
* string key = "creative_key_name";
|
* string key = "some key";
|
||||||
* string payload = "some payload";
|
* string payload = "some payload";
|
||||||
*
|
*
|
||||||
* // Write a message into an unassigned partition
|
* // Write a message into an unassigned partition
|
||||||
@@ -78,6 +78,9 @@ class TopicConfiguration;
|
|||||||
*/
|
*/
|
||||||
class CPPKAFKA_API Producer : public KafkaHandleBase {
|
class CPPKAFKA_API Producer : public KafkaHandleBase {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* The policy to use for the payload. The default policy is COPY_PAYLOAD
|
||||||
|
*/
|
||||||
enum PayloadPolicy {
|
enum PayloadPolicy {
|
||||||
COPY_PAYLOAD = RD_KAFKA_MSG_F_COPY, ///< Means RD_KAFKA_MSG_F_COPY
|
COPY_PAYLOAD = RD_KAFKA_MSG_F_COPY, ///< Means RD_KAFKA_MSG_F_COPY
|
||||||
FREE_PAYLOAD = RD_KAFKA_MSG_F_FREE ///< Means RD_KAFKA_MSG_F_FREE
|
FREE_PAYLOAD = RD_KAFKA_MSG_F_FREE ///< Means RD_KAFKA_MSG_F_FREE
|
||||||
|
|||||||
Reference in New Issue
Block a user