* 'relayerConfig' => [ 'class' => 'EventRelayerKafka', 'KafkaEventHost' => 'localhost:9092' ],
*/
class EventRelayerKafka extends EventRelayer {
-
/**
* Configuration.
*
/**
* Create Kafka producer.
*
- * @param Config $config
+ * @param array $params
*/
public function __construct( array $params ) {
+ parent::__construct( $params );
+
$this->config = new HashConfig( $params );
if ( !$this->config->has( 'KafkaEventHost' ) ) {
throw new InvalidArgumentException( "KafkaEventHost must be configured" );
*/
protected function getKafkaProducer() {
if ( !$this->producer ) {
- $this->producer = Produce::getInstance( null, null, $this->config->get( 'KafkaEventHost' ) );
+ $this->producer = Produce::getInstance(
+ null, null, $this->config->get( 'KafkaEventHost' ) );
}
return $this->producer;
}
- /**
- * (non-PHPdoc)
- *
- * @see EventRelayer::doNotify()
- *
- */
protected function doNotify( $channel, array $events ) {
$jsonEvents = array_map( 'json_encode', $events );
try {