RdKafka\ConsumerTopic::consume

(PECL rdkafka >= 0.9.1)

RdKafka\ConsumerTopic::consumeConsume a single message from a partition

Description

public RdKafka\Message RdKafka\ConsumerTopic::consume ( integer $partition , integer $timeout_ms )

Consume a single message from partition.

Consumer must have been previously started with RdKafka\ConsumerTopic::consumeStart().

Note:

The returned message's err property must be checked for errors.

Note:

The err property being equal to RD_KAFKA_RESP_ERR__PARTITION_EOF signals that the end of the partition has been reached, which should typically not be considered an error. The application should handle this case (e.g., ignore).

Parameters

partition (integer)

The partition to consume

timeout_ms

The maximum amount of time to wait for a message to be received.

Return Values

Returns a RdKafka\Message or NULL on timeout.