(PECL rdkafka >= 1.0.0)
RdKafka\Conf::setDrMsgCb — Set delivery report callback
Set delivery report callback. The delivery report callback will be called once for each message accepted by RdKafka\ProducerTopic::produce() with err
set to indicate the result of the produce request.
The callback is called when a message is succesfully produced or if librdkafka encountered a permanent failure, or the retry counter for temporary errors has been exhausted.
An application must call RdKafka::poll() at regular intervals to serve queued delivery report callbacks.
Returns no value.
Example #1 RdKafka\Conf::setDrMsgCb() example
<?php
$conf->setDrMsgCb(function ($kafka, $message) {
if ($message->err) {
// message permanently failed to be delivered
} else {
// message successfully delivered
}
});
?>