Processor Contract — Stream Processing Node

Processor is the main abstraction of the Low-Level Processor API for record stream processors (aka stream processing nodes) that can process one record at a time.

Processor can be added to a Topology using Topology.addProcessor operator (via ProcessorSupplier).

Streams DSL — High-Level Stream Processing DSL comes with the KStream.process operator to add a custom Processor to a topology (via ProcessorSupplier).

The lifecycle of a Processor is fully controlled by a corresponding ProcessorNode.

Table 1. Processor Contract
Method Description


void close()

Closes the processor

Used exclusively when ProcessorNode is requested to close.


void init(ProcessorContext context)

Initializes the processor with a ProcessorContext (that can be used to decide whether a record should be forwarded downstream to child processors if there are any)

Used exclusively when ProcessorNode is requested to init


void process(K key, V value)

Processes a single record (as a pair of a K key and a V value)

Used exclusively when ProcessorNode is requested to process a single record (as a key and value pair).

Use AbstractProcessor when you want to develop a custom Processor.
Table 2. Processors (Direct Implementations)
Processor Description


Abstract processor that manages a ProcessorContext instance and provides a no-op close implementation



results matching ""

    No results matching ""