(PECL rdkafka >= 0.9.1)
RdKafka\Conf::setErrorCb — Set error callback
Set error callback. The error callback is used by librdkafka to signal critical errors back to the application.
callback
(callable)A callable with one of the following signatures.
When used with a RdKafka\KafkaConsumer instance:
<?php
function (RdKafka\KafkaConsumer $kafka, int $err, string $reason);
When used with a RdKafka\Producer instance:
<?php
function (RdKafka\Producer $kafka, int $err, string $reason);
Returns no value.
Example #1 RdKafka\Conf::setErrorCb() example
<?php
$conf->setErrorCb(function ($kafka, $err, $reason) {
printf("Kafka error: %s (reason: %s)\n", rd_kafka_err2str($err), $reason);
});
?>