Interface ShareConsumerRecordRecoverer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ShareConsumerRecordRecoverer
A strategy interface for determining the acknowledgment action when a share consumer record fails processing. Implementations decide whether to ACCEPT, RELEASE, or REJECT the failed record.

Built-in implementations: REJECTING (log and REJECT, default), RELEASING (log and RELEASE for redelivery). Users can provide custom implementations or use a lambda.

Since:
4.1
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.springframework.core.log.LogAccessor
    Logger used by built-in implementations.
    Recoverer that logs the failure and REJECTs the record (archived, no redelivery).
    Recoverer that logs the failure and RELEASEs the record (available for redelivery).
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.kafka.clients.consumer.AcknowledgeType
    recover(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, Exception exception)
    Determine the acknowledgment action for a failed record.
  • Field Details

    • LOGGER

      static final org.springframework.core.log.LogAccessor LOGGER
      Logger used by built-in implementations.
    • REJECTING

      static final ShareConsumerRecordRecoverer REJECTING
      Recoverer that logs the failure and REJECTs the record (archived, no redelivery). This is the default when none is configured.
    • RELEASING

      static final ShareConsumerRecordRecoverer RELEASING
      Recoverer that logs the failure and RELEASEs the record (available for redelivery).
  • Method Details

    • recover

      org.apache.kafka.clients.consumer.AcknowledgeType recover(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, Exception exception)
      Determine the acknowledgment action for a failed record.
      Parameters:
      record - the record that failed processing
      exception - the exception thrown during processing
      Returns:
      the AcknowledgeType to use — typically REJECT or RELEASE