Class AbstractProcessor<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.processor.AbstractProcessor<K,V>
-
- Type Parameters:
K
- the type of keysV
- the type of values
- All Implemented Interfaces:
Processor<K,V>
public abstract class AbstractProcessor<K,V> extends Object implements Processor<K,V>
An abstract implementation ofProcessor
that manages theProcessorContext
instance and provides default no-op implementation ofclose()
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ProcessorContext
context
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this processor and clean up any resources.protected ProcessorContext
context()
Get the processor's context set duringinitialization
.void
init(ProcessorContext context)
Initialize this processor with the given context.
-
-
-
Field Detail
-
context
protected ProcessorContext context
-
-
Method Detail
-
init
public void init(ProcessorContext context)
Description copied from interface:Processor
Initialize this processor with the given context. The framework ensures this is called once per processor when the topology that contains it is initialized. When the framework is done with the processor,Processor.close()
will be called on it; the framework may later re-use the processor by calling#init()
again.The provided
context
can be used to access topology and record meta data, toschedule
a method to becalled periodically
and to access attachedStateStore
s.
-
close
public void close()
Close this processor and clean up any resources.This method does nothing by default; if desired, subclasses should override it with custom functionality.
-
context
protected final ProcessorContext context()
Get the processor's context set duringinitialization
.- Returns:
- the processor context; null only when called prior to
initialization
.
-
-