Interface Task
-
- All Known Implementing Classes:
AbstractTask,StandbyTask,StreamTask
public interface Task
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTask.Statestatic classTask.TaskType
-
Field Summary
Fields Modifier and Type Field Description static longLATEST_OFFSET
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddRecords(org.apache.kafka.common.TopicPartition partition, java.lang.Iterable<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]>> records)java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>changelogOffsets()java.util.Collection<org.apache.kafka.common.TopicPartition>changelogPartitions()voidcloseClean()Must be idempotent.voidcloseCleanAndRecycleState()Attempt a clean close but do not close the underlying statevoidcloseDirty()Must be idempotent.booleancommitNeeded()default booleancommitRequested()voidcompleteRestoration()StateStoregetStore(java.lang.String name)TaskIdid()voidinitializeIfNeeded()java.util.Set<org.apache.kafka.common.TopicPartition>inputPartitions()booleanisActive()booleanisClosed()voidmarkChangelogAsCorrupted(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)default booleanmaybePunctuateStreamTime()default booleanmaybePunctuateSystemTime()default booleanneedsInitializationOrRestoration()voidpostCommit()java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata>prepareCommit()default booleanprocess(long wallClockTime)default java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>purgeableOffsets()default voidrecordProcessBatchTime(long processBatchTime)default voidrecordProcessTimeRatioAndBufferSize(long allTaskProcessMs, long now)voidresume()voidrevive()Revive a closed task to a created one; should never throw an exceptionTask.Statestate()voidsuspend()voidupdate(java.util.Set<org.apache.kafka.common.TopicPartition> topicPartitions, java.util.Map<java.lang.String,java.util.List<java.lang.String>> allTopologyNodesToSourceTopics)Updates input partitions and topology after rebalance
-
-
-
Field Detail
-
LATEST_OFFSET
static final long LATEST_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
id
TaskId id()
-
state
Task.State state()
-
needsInitializationOrRestoration
default boolean needsInitializationOrRestoration()
-
isActive
boolean isActive()
-
isClosed
boolean isClosed()
-
initializeIfNeeded
void initializeIfNeeded()
- Throws:
LockException- could happen when multi-threads within the single instance, could retryStreamsException- fatal error, should close the thread
-
completeRestoration
void completeRestoration()
- Throws:
StreamsException- fatal error, should close the thread
-
addRecords
void addRecords(org.apache.kafka.common.TopicPartition partition, java.lang.Iterable<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]>> records)
-
commitNeeded
boolean commitNeeded()
-
prepareCommit
java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> prepareCommit()
- Throws:
StreamsException- fatal error, should close the thread
-
postCommit
void postCommit()
-
suspend
void suspend()
-
resume
void resume()
- Throws:
StreamsException- fatal error, should close the thread
-
closeClean
void closeClean()
Must be idempotent.
-
closeDirty
void closeDirty()
Must be idempotent.
-
update
void update(java.util.Set<org.apache.kafka.common.TopicPartition> topicPartitions, java.util.Map<java.lang.String,java.util.List<java.lang.String>> allTopologyNodesToSourceTopics)Updates input partitions and topology after rebalance
-
closeCleanAndRecycleState
void closeCleanAndRecycleState()
Attempt a clean close but do not close the underlying state
-
revive
void revive()
Revive a closed task to a created one; should never throw an exception
-
getStore
StateStore getStore(java.lang.String name)
-
inputPartitions
java.util.Set<org.apache.kafka.common.TopicPartition> inputPartitions()
-
changelogPartitions
java.util.Collection<org.apache.kafka.common.TopicPartition> changelogPartitions()
- Returns:
- any changelog partitions associated with this task
-
changelogOffsets
java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> changelogOffsets()
- Returns:
- the offsets of all the changelog partitions associated with this task, indicating the current positions of the logged state stores of the task.
-
markChangelogAsCorrupted
void markChangelogAsCorrupted(java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
-
purgeableOffsets
default java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> purgeableOffsets()
-
recordProcessBatchTime
default void recordProcessBatchTime(long processBatchTime)
-
recordProcessTimeRatioAndBufferSize
default void recordProcessTimeRatioAndBufferSize(long allTaskProcessMs, long now)
-
process
default boolean process(long wallClockTime)
-
commitRequested
default boolean commitRequested()
-
maybePunctuateStreamTime
default boolean maybePunctuateStreamTime()
-
maybePunctuateSystemTime
default boolean maybePunctuateSystemTime()
-
-