Interface PollExceptionStrategy

  • All Known Implementing Classes:
    BridgeErrorStrategy, DiscardErrorStrategy, ReconnectErrorStrategy, RetryErrorStrategy, StopErrorStrategy

    public interface PollExceptionStrategy
    Strategy to decide when a Kafka exception was thrown during polling, how to handle this. For example by re-connecting and polling the same message again, by stopping the consumer (allows to re-balance and let another consumer try), or to let Camel route the message as an exception which allows Camel error handling to handle the exception, or to discard this message and poll the next message.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean canContinue()
      This method provides an "answer" to whether the consumer can continue polling or not.
      void handle​(long partitionLastOffset, Exception exception)
      Controls how to handle the exception while polling from Kafka.
      default void reset()
      Reset any error flags set by a previous error condition
    • Method Detail

      • reset

        default void reset()
        Reset any error flags set by a previous error condition
      • canContinue

        boolean canContinue()
        This method provides an "answer" to whether the consumer can continue polling or not. This is specific to each polling exception strategy and must be implemented accordingly
        Returns:
        true if polling should continue or false otherwise
      • handle

        void handle​(long partitionLastOffset,
                    Exception exception)
        Controls how to handle the exception while polling from Kafka.
        Parameters:
        exception - the caused exception which typically would be a KafkaException