Modern C++ Kafka API
Public Types | Public Member Functions | List of all members
KAFKA_API::clients::producer::ProducerRecord Class Reference

A key/value pair to be sent to Kafka. More...

#include <ProducerRecord.h>

Public Types

using Id = std::uint64_t
 

Public Member Functions

 ProducerRecord (Topic topic, Partition partition, const Key &key, const Value &value)
 
 ProducerRecord (const Topic &topic, Partition partition, const Key &key, const Value &value, Id id)
 
 ProducerRecord (const Topic &topic, const Key &key, const Value &value)
 
 ProducerRecord (const Topic &topic, const Key &key, const Value &value, Id id)
 
const Topic & topic () const
 The topic this record is being sent to.
 
Partition partition () const
 The partition to which the record will be sent (or UNKNOWN_PARTITION if no partition was specified).
 
Key key () const
 The key (or null if no key is specified).
 
Value value () const
 The value.
 
Optional< Id > id () const
 The id to identify the message (consistent with Producer::Metadata::recordId()).
 
const Headers & headers () const
 The headers.
 
Headers & headers ()
 The headers. More...
 
void setPartition (Partition partition)
 Set the partition.
 
void setKey (const Key &key)
 Set the key.
 
void setValue (const Value &value)
 Set the value.
 
void setId (Id id)
 Set the record id.
 
std::string toString () const
 

Detailed Description

A key/value pair to be sent to Kafka.

This consists of a topic name to which the record is being sent, an optional partition number, and an optional key and value. Note: ProducerRecord would not take the ownership from the memory block of Value.

Member Function Documentation

◆ headers()

Headers& KAFKA_API::clients::producer::ProducerRecord::headers ( )
inline

The headers.

Note: Users could set headers with the reference.


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