Task Contract — Stream Processor Tasks

Table 1. Task Contract
Method Description

applicationId

String applicationId()

Application ID of the Kafka Streams application the task belongs to

changelogPartitions

Collection<TopicPartition> changelogPartitions()

Changelog partitions associated with the task

Used when:

close

void close(
  boolean clean,
  boolean isZombie)

Closes the task

Used when:

closeSuspended

void closeSuspended(
  boolean clean,
  boolean isZombie,
  RuntimeException e)

Used when:

commit

void commit()

Commits the task

Used when:

commitNeeded

boolean commitNeeded()

Used when:

context

ProcessorContext context()

ProcessorContext of the task

getStore

StateStore getStore(String name)

Looks up the state store by name

Used exclusively when StreamThreadStateStoreProvider is requested for the stores

hasStateStores

boolean hasStateStores()

id

TaskId id()

TaskId of the task

initializeStateStores

boolean initializeStateStores()

Initializes state stores (of the ProcessorTopology)

Enabled (true) if the task has no state stores that need restoring.

  • StandbyTask always returns true

Used exclusively when AssignedTasks is requested to initialize new tasks

initializeTopology

void initializeTopology()

Initializes the topology of processor nodes

Used exclusively when AssignedTasks is requested to mark the specified task as ready for execution and processing records

partitions

Set<TopicPartition> partitions()

Used when:

resume

void resume()

Resumes the task

Used exclusively when AssignedTasks is requested to attempt to resume suspended task (when the task has actually been suspended)

suspend

void suspend()

Suspends the task

Used exclusively when AssignedTasks is requested to suspend tasks.

topology

ProcessorTopology topology()

ProcessorTopology of the task

toString

String toString(String indent)

Describes the task (textual representation)

Note
AbstractTask is the base implementation of the Task Contract in Kafka Streams (with StandbyTask and StreamTask as the only concrete implementations).

results matching ""

    No results matching ""