The RdKafka\Message class

(PECL rdkafka >= 0.9.1)

Introduction

This object represents either a single consumed or produced message, or an event ($err is set).

An application must check RdKafka\Message::err to see if the object is a proper message (error is RD_KAFKA_RESP_ERR_NO_ERROR) or an error event.

Class synopsis

class RdKafka\Message {
/* Properties */
public int|null $err;
public int|null $len;
public string|null $topic_name;
public int|null $timestamp;
public int|null $partition;
public string|null $payload;
public string|null $key;
public int|null $offset;
public string|null $opaque;
/* Methods */
public errstr(): string
public headers(): string
}

Properties

err

Error code

len

Length

topic_name

Topic name

timestamp

Timestamp

partition

Partition

payload

Payload

key

Key

offset

Offset

opaque

In a delivery callback context, this is the value of the opaque from the RdKafka\ProducerTopic::produce() or RdKafka\ProducerTopic::producev() call. (Since PECL rdkafka 5.0.0 with librdkafka >= 1.0.0.)

Table of Contents