StreamsProducer¶
StreamsProducer uses a Kafka Producer to send records for RecordCollectorImpl.
Creating Instance¶
StreamsProducer takes the following to be created:
- StreamsConfig
- Thread ID
- KafkaClientSupplier
- TaskId
- Process ID
-
LogContext
StreamsProducer is created when:
ActiveTaskCreatoris created and requested to createActiveTask
Kafka Producer¶
StreamsProducer requests the KafkaClientSupplier to get a Kafka Producer (Producer<byte[], byte[]>) when created and requested to resetProducer.
Sending Record¶
Future<RecordMetadata> send(
ProducerRecord<byte[], byte[]> record,
Callback callback)
send maybeBeginTransaction and requests the Producer to send the record (with the given Callback).
send is used when:
RecordCollectorImplis requested to send a record
maybeBeginTransaction¶
void maybeBeginTransaction()
maybeBeginTransaction...FIXME
maybeBeginTransaction is used when:
StreamsProduceris requested to send a record and commitTransaction
commitTransaction¶
void commitTransaction(
Map<TopicPartition, OffsetAndMetadata> offsets,
ConsumerGroupMetadata consumerGroupMetadata)
commitTransaction...FIXME
commitTransaction is used when:
TaskManageris requested to commitOffsetsOrTransactionTopologyTestDriveris requested to commit