Class KafkaOpenMetadataEventProducer
java.lang.Object
org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
org.odpi.openmetadata.adapters.eventbus.topic.kafka.KafkaOpenMetadataEventProducer
- All Implemented Interfaces:
Runnable
KafkaOpenMetadataEventProducer manages the sending of events on Apache Kafka.
Callers hand events to sendEvent(String), which only places them on a bounded in-memory queue and
so never blocks the calling thread - even when Kafka is down. A single producer thread drains the queue and
hands each event to the Kafka client asynchronously. The Kafka client batches, compresses and pipelines the
events, and reports the outcome of each one through a callback, so throughput is no longer limited to one
broker round trip per event.
The queue is owned by the topic connector rather than this object, so events waiting to be sent survive a restart of the producer thread. When the queue is full, new events are discarded (and counted) rather than allowed to exhaust the heap.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
auditLog -
Method Summary
Modifier and TypeMethodDescriptionvoidrun()This is the method that provides the behaviour of the thread.voidNormal shutdownvoidQueue the supplied event for sending.Methods inherited from class org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
logExceptionRecord, logExceptionRecord, logRecord, logRecord
-
Method Details
-
sendEvent
Queue the supplied event for sending. This method never blocks. If the queue is full, the event is discarded and counted, because the alternatives - blocking the caller or growing the queue without limit - stall or crash the server.- Parameters:
event- event to publish
-
run
public void run()This is the method that provides the behaviour of the thread. -
safeCloseProducer
public void safeCloseProducer()Normal shutdown
-