Skip to content

Commit 7ec3252

Browse files
committed
Minor documentation improvements
1 parent 03189b8 commit 7ec3252

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

include/cppkafka/consumer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ class TopicConfiguration;
7979
* consumer.subscribe({ "my_topic" });
8080
* while (true) {
8181
* // Poll. This will optionally return a message. It's necessary to check if it's a valid
82-
* // one before using it or bad things will happen
82+
* // one before using it
8383
* Message msg = consumer.poll();
8484
* if (msg) {
85-
* // It's a valid message!
8685
* if (!msg.get_error()) {
8786
* // It's an actual message. Get the payload and print it to stdout
8887
* cout << msg.get_payload().as_string() << endl;
8988
* }
90-
* else {
91-
* // Is it an error notification
92-
* // ...
89+
* else if (!msg.is_eof()) {
90+
* // Is it an error notification, handle it.
91+
* // This is explicitly skipping EOF notifications as they're not actually errors,
92+
* // but that's how rdkafka provides them
9393
* }
9494
* }
9595
* }

include/cppkafka/message.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class MessageTimestamp;
4848
*
4949
* This is a non copyable, movable class that wraps a rd_kafka_message_t*.
5050
*
51-
* Messages can be empty (contain a null rd_kafka_message_t*). Therefore, users should check
51+
* Messages can be empty (contain a null rd_kafka_message_t*). Therefore, users must check
5252
* that the message isn't empty by using the operator bool() before using them. This is especially
5353
* necessary when calling Consumer::poll() as any poll operation that returns a null pointer will
5454
* return an empty message.
@@ -151,6 +151,9 @@ class CPPKAFKA_API Message {
151151
Buffer key_;
152152
};
153153

154+
/**
155+
* Represents a message's timestamp
156+
*/
154157
class CPPKAFKA_API MessageTimestamp {
155158
public:
156159
/**

include/cppkafka/producer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class TopicConfiguration;
6565
* Producer producer(config);
6666
*
6767
* // Create some key and payload
68-
* string key = "creative_key_name";
68+
* string key = "some key";
6969
* string payload = "some payload";
7070
*
7171
* // Write a message into an unassigned partition
@@ -78,6 +78,9 @@ class TopicConfiguration;
7878
*/
7979
class CPPKAFKA_API Producer : public KafkaHandleBase {
8080
public:
81+
/**
82+
* The policy to use for the payload. The default policy is COPY_PAYLOAD
83+
*/
8184
enum PayloadPolicy {
8285
COPY_PAYLOAD = RD_KAFKA_MSG_F_COPY, ///< Means RD_KAFKA_MSG_F_COPY
8386
FREE_PAYLOAD = RD_KAFKA_MSG_F_FREE ///< Means RD_KAFKA_MSG_F_FREE

0 commit comments

Comments
 (0)