Modern C++ Kafka API
Public Member Functions | List of all members
KAFKA_API::clients::consumer::ConsumerRecord Class Reference

A key/value pair to be received from Kafka. More...

#include <ConsumerRecord.h>

Public Member Functions

 ConsumerRecord (rd_kafka_message_t *msg)
 
Topic topic () const
 The topic this record is received from.
 
Partition partition () const
 The partition from which this record is received.
 
Offset offset () const
 The position of this record in the corresponding Kafka partition.
 
Key key () const
 The key (or null if no key is specified).
 
Value value () const
 The value.
 
Timestamp timestamp () const
 The timestamp of the record.
 
Headers headers () const
 The headers of the record.
 
Header::Value lastHeaderValue (const Header::Key &key)
 Return just one (the very last) header's value for the given key.
 
Error error () const
 The error. More...
 
std::string toString () const
 Obtains explanatory string.
 

Detailed Description

A key/value pair to be received from Kafka.

This also consists of a topic name and a partition number from which the record is being received, an offset that points to the record in a Kafka partition

Member Function Documentation

◆ error()

Error KAFKA_API::clients::consumer::ConsumerRecord::error ( ) const
inline

The error.

Possible cases:

  1. Success
    • RD_KAFKA_RESP_ERR_NO_ERROR (0), – got a message successfully
    • RD_KAFKA_RESP_ERR__PARTITION_EOF, – reached the end of a partition (got no message)
  2. Failure

The documentation for this class was generated from the following file: