RdKafka\ConsumerTopic::consumeCallback

(PECL rdkafka >= 4.0.1)

RdKafka\ConsumerTopic::consumeCallbackConsume messages through a provided callback

Description

public RdKafka\ConsumerTopic::consumeCallback ( integer $partition , integer $timeout_ms , callable $callback ) : void

Consume messages through a callback from a given partition. Of all the low level consuming methods, this is the fastest.

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

Parameters

partition (integer)

The partition to consume

timeout_ms

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

callback

A callable with the following signature:

<?php
/**
 * @param object $message
 */
function ($message);

Errors/Exceptions

  • Throws RdKafka\Exception on errors.
  • Throws InvalidArgumentException on argument parsing errors.