Task¶
Task
is an abstraction of tasks.
Contract¶
Adding Records (to Active StreamTasks)¶
void addRecords(
TopicPartition partition,
Iterable<ConsumerRecord<byte[], byte[]>> records)
Adds records to StreamTasks (while StandbyTasks throw an IllegalStateException
)
Used when:
TaskManager
is requested to add records to active tasksTopologyTestDriver
is requested to enqueueTaskRecord
changelogOffsets¶
Map<TopicPartition, Long> changelogOffsets()
changelogPartitions¶
Collection<TopicPartition> changelogPartitions()
clearTaskTimeout¶
void clearTaskTimeout()
closeClean¶
void closeClean()
closeCleanAndRecycleState¶
void closeCleanAndRecycleState()
closeDirty¶
void closeDirty()
commitNeeded¶
boolean commitNeeded()
committedOffsets¶
Map<TopicPartition, Long> committedOffsets()
completeRestoration¶
void completeRestoration(
java.util.function.Consumer<Set<TopicPartition>> offsetResetter)
Used when:
TaskManager
is requested to tryToCompleteRestorationTopologyTestDriver
is requested to setupTask
getStore¶
StateStore getStore(
String name)
Used when:
StreamThreadStateStoreProvider
is requested for stores
highWaterMark¶
Map<TopicPartition, Long> highWaterMark()
TaskId¶
TaskId id()
initializeIfNeeded¶
void initializeIfNeeded()
inputPartitions¶
Set<TopicPartition> inputPartitions()
isActive¶
boolean isActive()
markChangelogAsCorrupted¶
void markChangelogAsCorrupted(
Collection<TopicPartition> partitions)
maybeInitTaskTimeoutOrThrow¶
void maybeInitTaskTimeoutOrThrow(
long currentWallClockMs,
Exception cause)
maybePunctuateStreamTime¶
boolean maybePunctuateStreamTime()
Default: false
Used when:
TaskManager
is requested to punctuateTopologyTestDriver
is requested to completeAllProcessableWork
maybePunctuateSystemTime¶
boolean maybePunctuateSystemTime()
Default: false
Used when:
TaskManager
is requested to punctuateTopologyTestDriver
is requested to advanceWallClockTime
needsInitializationOrRestoration¶
boolean needsInitializationOrRestoration()
Default: Whether this task is in CREATED
or RESTORING
state
Used when:
TaskManager
is requested for needsInitializationOrRestoration
postCommit¶
void postCommit(
boolean enforceCheckpoint)
prepareCommit¶
Map<TopicPartition, OffsetAndMetadata> prepareCommit()
Used when:
TaskManager
is requested to closeDirtyAndRevive, handleCloseAndRecycle, prepareCommitAndAddOffsetsToMap, closeTaskDirty, tryCloseCleanAllActiveTasks, tryCloseCleanAllStandbyTasks and commitAndFillInConsumedOffsetsAndMetadataPerTaskMapTopologyTestDriver
is requested to completeAllProcessableWork, advanceWallClockTime and close
Processing Record¶
boolean process(
long wallClockTime)
Default: false
(and overriden in StreamTask)
Used when:
TaskManager
is requested to process recordsTopologyTestDriver
is requested to completeAllProcessableWork
Resuming¶
void resume()
revive¶
void revive()
state¶
State state()
suspend¶
void suspend()
timeCurrentIdlingStarted¶
Optional<Long> timeCurrentIdlingStarted()
updateInputPartitions¶
void updateInputPartitions(
Set<TopicPartition> topicPartitions,
Map<String, List<String>> allTopologyNodesToSourceTopics)