Class EventProcessor<T>

java.lang.Object
org.apache.kafka.clients.consumer.internals.events.EventProcessor<T>
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
ApplicationEventProcessor

public abstract class EventProcessor<T> extends Object implements Closeable
An EventProcessor is the means by which events produced by thread A are processed by thread B. By definition, threads A and B run in parallel to each other, so a mechanism is needed with which to receive and process the events from the other thread. That communication channel is formed around a shared queue into which thread A enqueues events and thread B reads and processes those events.
  • Constructor Details

    • EventProcessor

      protected EventProcessor(org.apache.kafka.common.utils.LogContext logContext, BlockingQueue<T> eventQueue)
  • Method Details

    • process

      public abstract boolean process()
    • process

      protected abstract void process(T event)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • process

      protected boolean process(EventProcessor.ProcessHandler<T> processHandler)
      Drains all available events from the queue, and then processes them in order. If any errors are thrown while processing the individual events, these are submitted to the given EventProcessor.ProcessHandler.