Class RecoveringBatchErrorHandler

    • Constructor Detail

      • RecoveringBatchErrorHandler

        public RecoveringBatchErrorHandler()
        Construct an instance with the default recoverer which simply logs the record after 10 (maxFailures) have occurred for a topic/partition/offset.
      • RecoveringBatchErrorHandler

        public RecoveringBatchErrorHandler​(org.springframework.util.backoff.BackOff backOff)
        Construct an instance with the default recoverer which simply logs the record after the backOff returns STOP for a topic/partition/offset.
        Parameters:
        backOff - the BackOff.
      • RecoveringBatchErrorHandler

        public RecoveringBatchErrorHandler​(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,​?>,​java.lang.Exception> recoverer)
        Construct an instance with the provided recoverer which will be called after 10 (maxFailures) have occurred for a topic/partition/offset.
        Parameters:
        recoverer - the recoverer.
      • RecoveringBatchErrorHandler

        public RecoveringBatchErrorHandler​(@Nullable
                                           java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,​?>,​java.lang.Exception> recoverer,
                                           org.springframework.util.backoff.BackOff backOff)
        Construct an instance with the provided recoverer which will be called after the backOff returns STOP for a topic/partition/offset.
        Parameters:
        recoverer - the recoverer; if null, the default (logging) recoverer is used.
        backOff - the BackOff.
        Since:
        2.3
    • Method Detail

      • isAckAfterHandle

        public boolean isAckAfterHandle()
        Description copied from interface: GenericErrorHandler
        Return true if the offset should be committed for a handled error (no exception thrown).
        Specified by:
        isAckAfterHandle in interface GenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecords<?,​?>>
        Returns:
        true to commit.
      • setAckAfterHandle

        public void setAckAfterHandle​(boolean ackAfterHandle)
        Description copied from interface: GenericErrorHandler
        Set to false to prevent the container from committing the offset of a recovered record (when the error handler does not itself throw an exception).
        Specified by:
        setAckAfterHandle in interface GenericErrorHandler<org.apache.kafka.clients.consumer.ConsumerRecords<?,​?>>
        Parameters:
        ackAfterHandle - false to not commit.