This example shows how to consume messages at least once. This is achieved by committing offsets only after a message has been successfully consumed.
Example #1 Low-level consumer: at least once consuming example
<?php
$topic = $rk->newTopic("test", $topicConf);
// ...
$message = $rk->consume(0, 120*1000);
handle_message($message);
// After successfully consuming the message, schedule offset store.
// Offset is actually committed after 'auto.commit.interval.ms'
// milliseconds.
$topic->offsetStore($message->partition, $message->offset);
?>