Class ContextualProcessor<KIn,​VIn,​KOut,​VOut>

java.lang.Object
org.apache.kafka.streams.processor.api.ContextualProcessor<KIn,​VIn,​KOut,​VOut>
Type Parameters:
KIn - the type of input keys
VIn - the type of input values
KOut - the type of output keys
VOut - the type of output values
All Implemented Interfaces:
Processor<KIn,​VIn,​KOut,​VOut>

public abstract class ContextualProcessor<KIn,​VIn,​KOut,​VOut>
extends Object
implements Processor<KIn,​VIn,​KOut,​VOut>
An abstract implementation of Processor that manages the ProcessorContext instance and provides default no-op implementation of Processor.close().
  • Field Details

  • Constructor Details

    • ContextualProcessor

      protected ContextualProcessor()
  • Method Details

    • init

      public void init​(ProcessorContext<KOut,​VOut> 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, to schedule a method to be called periodically and to access attached StateStores.

      Specified by:
      init in interface Processor<KIn,​VIn,​KOut,​VOut>
      Parameters:
      context - the context; may not be null
    • context

      protected final ProcessorContext<KOut,​VOut> context()
      Get the processor's context set during initialization.
      Returns:
      the processor context; null only when called prior to initialization.