Class AbstractProcessor<K,​V>

  • Type Parameters:
    K - the type of keys
    V - the type of values
    All Implemented Interfaces:
    Processor<K,​V>

    public abstract class AbstractProcessor<K,​V>
    extends java.lang.Object
    implements Processor<K,​V>
    An abstract implementation of Processor that manages the ProcessorContext instance and provides default no-op implementations of punctuate(long) and close().
    • Constructor Detail

      • AbstractProcessor

        protected AbstractProcessor()
    • 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.

        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<K,​V>
        Parameters:
        context - the context; may not be null
      • punctuate

        public void punctuate​(long timestamp)
        Perform any periodic operations, if this processor schedule itself with the context during initialization.

        This method does nothing by default; if desired, subclasses should override it with custom functionality.

        Specified by:
        punctuate in interface Processor<K,​V>
        Parameters:
        timestamp - the wallclock time when this method is being called
      • 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.

        Specified by:
        close in interface Processor<K,​V>