31 parent::__construct( $params );
34 if ( !$this->config->has(
'KafkaEventHost' ) ) {
35 throw new InvalidArgumentException(
"KafkaEventHost must be configured" );
44 if ( !$this->producer ) {
45 $this->producer = Produce::getInstance(
46 null,
null, $this->config->get(
'KafkaEventHost' ) );
51 protected function doNotify( $channel, array $events ) {
52 $jsonEvents = array_map(
'json_encode', $events );
55 $producer->setMessages( $channel, 0, $jsonEvents );
57 }
catch ( \Kafka\Exception $e ) {
58 $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.
Interface for configuration instances.