Kafka events
To handle Kafka events (opens in a new tab), extend the KafkaHandler
class:
use Bref\Context\Context;
use Bref\Event\Kafka\KafkaEvent;
use Bref\Event\Kafka\KafkaEventHandler;
class Handler extends KafkaEvent
{
public function handleKafka(KafkaEvent $event, Context $context): void
{
foreach ($event->getRecords() as $record) {
$data = $record->getValue();
// do something
}
}
}