33 if ( !$this->config->has(
'KafkaEventHost' ) ) {
34 throw new InvalidArgumentException(
"KafkaEventHost must be configured" );
43 if ( !$this->producer ) {
44 $this->producer = Produce::getInstance(
45 null,
null, $this->config->get(
'KafkaEventHost' ) );
50 protected function doNotify( $channel, array $events ) {
51 $jsonEvents = array_map(
'json_encode', $events );
54 $producer->setMessages( $channel, 0, $jsonEvents );
56 }
catch ( \Kafka\Exception
$e ) {
57 $this->logger->warning(
"Sending events failed: $e" );
Event relayer for Apache Kafka.
doNotify( $channel, array $events)
__construct(array $params)
Create Kafka producer.
getKafkaProducer()
Get the producer object from kafka-php.
Config $config
Configuration.
Produce $producer
Kafka producer.
Base class for reliable event relays.
A Config instance which stores all settings as a member variable.
returning false will NOT prevent logging $e
Interface for configuration instances.