Class KafkaPublisher
java.lang.Object
org.eso.ias.plugin.publisher.PublisherBase
org.eso.ias.plugin.publisher.impl.KafkaPublisher
- All Implemented Interfaces:
MonitorPointSender
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eso.ias.plugin.publisher.MonitorPointSender
MonitorPointSender.SenderStats -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe topic name for kafka publisher (in the actual implementation all the plugins publish on the same topic but each one has its own partition).static final StringThe name of the java property to set the kafka topic.static final StringThe topic name red from the passed property if exists, or the default.Fields inherited from class org.eso.ias.plugin.publisher.PublisherBase
defaultBufferSize, defaultThrottlingTime, iso8601dateFormat, MAX_BUFFER_SIZE_PROPNAME, maxBufferSize, monitoredSystemId, monitorPoints, monitorPointsSent, numOfErrorsSending, pluginId, publishedMessages, THROTTLING_PROPNAME, throttlingTime -
Constructor Summary
ConstructorsConstructorDescriptionKafkaPublisher(String pluginId, String monitoredSystemId, SimpleStringProducer producer, ScheduledExecutorService executorSvc) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected longpublish(MonitorPointData mpData) Push a monitor point values in the kafka topic and partition.protected voidshutdown()Close the kafka producer: does nothing because the kafka producer is shared and the initialization and closed will be done by the ownerprotected voidstart()Initializes the kafka producer: does nothing because the kafka producer is shared and the initialization and closed will be done by the ownerMethods inherited from class org.eso.ias.plugin.publisher.PublisherBase
getStats, isClosed, isStopped, mergeProperties, offer, sendMonitoredPointsToIas, setUp, startSending, stopSending, tearDown
-
Field Details
-
KAFKA_TOPIC_PROP_NAME
The name of the java property to set the kafka topic.If not set,
defaultTopicNameis used.- See Also:
-
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
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 pluginmonitoredSystemId- The identifier of the system monitored by the pluginproducer- The shared kafka producerexecutorSvc- The executor service
-
-
Method Details
-
publish
Push a monitor point values in the kafka topic and partition.- Specified by:
publishin classPublisherBase- 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
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:
startin classPublisherBase- Throws:
PublisherException- Exception returned by the implementer
-
shutdown
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:
shutdownin classPublisherBase- Throws:
PublisherException- In case of error shutting down
-