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
Modifier and TypeFieldDescriptionstatic final String
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).static final String
The name of the java property to set the kafka topic.static final String
The 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
ConstructorDescriptionKafkaPublisher
(String pluginId, String monitoredSystemId, SimpleStringProducer producer, ScheduledExecutorService executorSvc) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected long
publish
(MonitorPointData mpData) Push a monitor point values in the kafka topic and partition.protected void
shutdown()
Close the kafka producer: does nothing because the kafka producer is shared and the initialization and closed will be done by the ownerprotected void
start()
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,
defaultTopicName
is 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:
publish
in 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:
start
in 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:
shutdown
in classPublisherBase
- Throws:
PublisherException
- In case of error shutting down
-