Class KafkaPublisher

java.lang.Object
org.eso.ias.plugin.publisher.PublisherBase
org.eso.ias.plugin.publisher.impl.KafkaPublisher
All Implemented Interfaces:
MonitorPointSender

public class KafkaPublisher extends PublisherBase
The publisher of monitor point values through Kafka.

KafkaPublisher is an unbuffered publisher because Kafka already does its own buffering and optimizations.

Kafka topic is hardcoded in defaultTopicName property. It delegates to SimpleStringProducer

Author:
acaproni
  • Field Details

    • KAFKA_TOPIC_PROP_NAME

      public static final String KAFKA_TOPIC_PROP_NAME
      The name of the java property to set the kafka topic.

      If not set, defaultTopicName is used.

      See Also:
    • defaultTopicName

      public static final String defaultTopicName
      The topic name for kafka publisher (in the actual implementation all the plugins publish on the same topic but each one has its own partition).
      See Also:
    • topicName

      public static final String topicName
      The topic name red from the passed property if exists, or the default.
  • Constructor Details

    • KafkaPublisher

      public KafkaPublisher(String pluginId, String monitoredSystemId, SimpleStringProducer producer, ScheduledExecutorService executorSvc)
      Constructor
      Parameters:
      pluginId - The identifier of the plugin
      monitoredSystemId - The identifier of the system monitored by the plugin
      producer - The shared kafka producer
      executorSvc - The executor service
  • Method Details

    • publish

      protected long publish(MonitorPointData mpData) throws PublisherException
      Push a monitor point values in the kafka topic and partition.
      Specified by:
      publish in class PublisherBase
      Parameters:
      mpData - The monitor point data to send to the core of the IAS
      Returns:
      The number of bytes sent to the core of the IAS
      Throws:
      PublisherException - In case of error publishing
    • start

      protected void start() throws PublisherException
      Initializes the kafka producer: does nothing because the kafka producer is shared and the initialization and closed will be done by the owner
      Specified by:
      start in class PublisherBase
      Throws:
      PublisherException - Exception returned by the implementer
    • shutdown

      protected void shutdown() throws PublisherException
      Close the kafka producer: does nothing because the kafka producer is shared and the initialization and closed will be done by the owner
      Specified by:
      shutdown in class PublisherBase
      Throws:
      PublisherException - In case of error shutting down