StreamTask
is a concrete stream processor task that uses a PartitionGroup for…FIXME
StreamTask
is created exclusively when TaskCreator
is requested to create a StreamTask.
StreamTask
may need a commit, i.e….FIXME
StreamTask
uses commitOffsetNeeded
flag to…FIXME
StreamTask
uses buffered.records.per.partition configuration property to control when to resume a partition (when processing a single record).
Name | Description |
---|---|
|
PartitionGroup (with a RecordQueue per TopicPartition) Used when |
|
Offsets by topic partitions, i.e. |
Tip
|
Enable Add the following line to
Refer to Application Logging Using log4j. |
void closeTopology()
closeTopology
…FIXME
Note
|
closeTopology is used exclusively when StreamTask is requested to suspend.
|
void suspend() // (1)
// PRIVATE API
void suspend(final boolean clean)
-
Uses
clean
flag enabled, i.e.true
Note
|
suspend is part of Task Contract to…FIXME.
|
suspend
…FIXME
Note
|
The private suspend is used exclusively when StreamTask is requested to close.
|
void close(
final boolean clean,
final boolean isZombie)
Note
|
close is part of Task Contract to…FIXME.
|
close
…FIXME
StreamTask
takes the following when created:
-
Kafka Consumer (of keys and values as array of bytes)
StreamTask
initializes the internal registries and counters.
void initTopology()
initTopology
…FIXME
Note
|
initTopology is used when…FIXME
|
void initializeTopology()
Note
|
initializeTopology is part of Task Contract to…FIXME.
|
initializeTopology
initTopology. It then requests InternalProcessorContext to initialized and in the end sets taskInitialized to true
.
void updateProcessorContext(final StampedRecord record, final ProcessorNode currNode)
updateProcessorContext
…FIXME
Note
|
updateProcessorContext is used when…FIXME
|
boolean process()
process
requests PartitionGroup for nextRecord (with RecordInfo).
process
prints out the following TRACE message to the logs:
Start processing one record [record]
process
requests RecordInfo for the source processor node.
process
updateProcessorContext (with the current record and the source processor node).
process
requests the source processor node to process the key and the value of the record.
process
prints out the following TRACE message to the logs:
Completed processing one record [record]
process
requests RecordInfo for the topic partition and stores the partition and the record’s offset in consumedOffsets.
process
turns commitOffsetNeeded flag on.
process
requests the Kafka consumer to resume the partition if the size of the queue of the RecordInfo is exactly maxBufferedSize.
process
always requests InternalProcessorContext to setCurrentNode as null
.
In case of a ProducerFencedException
, process
reports a TaskMigratedException
.
In case of a KafkaException
, process
reports a StreamsException
.
In the end, process
gives true
when processing a single record was successful, and false
when there were no records to process.
Note
|
process is used exclusively when AssignedStreamsTasks is requested to process.
|
void closeSuspended(
boolean clean,
final boolean isZombie,
RuntimeException firstException)
Note
|
closeSuspended is part of Task Contract to…FIXME.
|
closeSuspended
…FIXME
int addRecords(
final TopicPartition partition,
final Iterable<ConsumerRecord<byte[], byte[]>> records)
addRecords
requests PartitionGroup to add records to a RecordQueue for a Kafka partition.
You should see the following TRACE message in the logs:
Added records into the buffered queue of partition [partition], new queue size is [newQueueSize]"
addRecords
requests the Kafka Consumer to pause the partition if the queue size of the partition exceeded buffered.records.per.partition configuration property.
In the end, addRecords
returns the number of records added.
Note
|
addRecords is used exclusively when StreamThread is requested to add records to active stream tasks (and report skipped records).
|
Map<TopicPartition, Long> recordCollectorOffsets()
Note
|
recordCollectorOffsets is part of AbstractTask Contract to…FIXME.
|
recordCollectorOffsets
…FIXME
void punctuate(
final ProcessorNode node,
final long timestamp,
final PunctuationType type,
final Punctuator punctuator)
Note
|
punctuate is part of ProcessorNodePunctuator Contract to execute a scheduled periodic action.
|
punctuate
…FIXME
boolean maybePunctuateStreamTime()
maybePunctuateStreamTime
…FIXME
Note
|
maybePunctuateStreamTime is used exclusively when AssignedStreamsTasks is requested to punctuate.
|
boolean maybePunctuateSystemTime()
maybePunctuateSystemTime
…FIXME
Note
|
maybePunctuateSystemTime is used exclusively when AssignedStreamsTasks is requested to punctuate.
|
// PUBLIC API
Cancellable schedule(
final long interval,
final PunctuationType type,
final Punctuator punctuator)
// PACKAGE PROTECTED
Cancellable schedule(
final long startTime,
final long interval,
final PunctuationType type,
final Punctuator punctuator)
schedule
…FIXME
Note
|
schedule is used exclusively when ProcessorContextImpl is requested to schedule.
|