KafkaDataWriter¶
KafkaDataWriter is a DataWriter.
KafkaRowWriter¶
KafkaDataWriter is a KafkaRowWriter (for the input schema and topic).
Creating Instance¶
KafkaDataWriter takes the following to be created:
- Optional Topic Name (target topic)
- Kafka Producer Parameters
- Input Schema (Attributes)
KafkaDataWriter is created when:
KafkaBatchWriterFactoryis requested for a DataWriterKafkaStreamWriterFactory(Spark Structured Streaming) is requested for aDataWriter
Cached KafkaProducer¶
producer: Option[CachedKafkaProducer] = None
KafkaDataWriter defines producer internal registry for a CachedKafkaProducer:
produceris undefined whenKafkaDataWriteris createdCachedKafkaProduceris created (aquired) when writing out a rowproduceris cleared (dereferenced) in close
Once defined, KafkaDataWriter uses the KafkaProducer to send a row (when writing out a row).
KafkaDataWriter requests the KafkaProducer to flush out rows in commit.
FIXME: Why is InternalKafkaProducerPool required?