Class RecoveringProductionExceptionHandler

java.lang.Object
org.springframework.kafka.streams.AbstractRecoveringExceptionHandler<org.apache.kafka.streams.errors.ProductionExceptionHandler.Response>
org.springframework.kafka.streams.RecoveringProductionExceptionHandler
All Implemented Interfaces:
org.apache.kafka.common.Configurable, org.apache.kafka.streams.errors.ProductionExceptionHandler

public class RecoveringProductionExceptionHandler extends AbstractRecoveringExceptionHandler<org.apache.kafka.streams.errors.ProductionExceptionHandler.Response> implements org.apache.kafka.streams.errors.ProductionExceptionHandler
A ProductionExceptionHandler that calls a ConsumerRecordRecoverer or uses the native Kafka Streams DLQ and continues.
Since:
4.1
Author:
Loïc Greffier
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.kafka.streams.errors.ProductionExceptionHandler

    org.apache.kafka.streams.errors.ProductionExceptionHandler.ProductionExceptionHandlerResponse, org.apache.kafka.streams.errors.ProductionExceptionHandler.Response, org.apache.kafka.streams.errors.ProductionExceptionHandler.Result, org.apache.kafka.streams.errors.ProductionExceptionHandler.SerializationExceptionOrigin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Property name for configuring the native DLQ destination resolver.
    static final String
    Property name for configuring the recoverer using properties.

    Fields inherited from class org.springframework.kafka.streams.AbstractRecoveringExceptionHandler

    deadLetterRecordManager, deadLetterTopic, destinationResolver, recoverer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(Map<String,?> configs)
    protected org.apache.kafka.streams.errors.ProductionExceptionHandler.Response
    Create a response indicating that processing should fail.
    org.apache.kafka.streams.errors.ProductionExceptionHandler.Response
    handleError(org.apache.kafka.streams.errors.ErrorHandlerContext context, org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> record, Exception exception)
    org.apache.kafka.streams.errors.ProductionExceptionHandler.Response
    handleSerializationError(org.apache.kafka.streams.errors.ErrorHandlerContext context, org.apache.kafka.clients.producer.ProducerRecord record, Exception exception, org.apache.kafka.streams.errors.ProductionExceptionHandler.SerializationExceptionOrigin origin)
    protected org.apache.kafka.streams.errors.ProductionExceptionHandler.Response
    resume(List<org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]>> deadLetterRecords)
    Create a response indicating that processing should resume.

    Methods inherited from class org.springframework.kafka.streams.AbstractRecoveringExceptionHandler

    configureCommon, handleErrorCommon

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.kafka.streams.errors.ProductionExceptionHandler

    handle, handle, handleSerializationException, handleSerializationException
  • Field Details

    • RECOVERER

      public static final String RECOVERER
      Property name for configuring the recoverer using properties.
      See Also:
    • DLQ_DESTINATION_RESOLVER

      public static final String DLQ_DESTINATION_RESOLVER
      Property name for configuring the native DLQ destination resolver.
      See Also:
  • Constructor Details

    • RecoveringProductionExceptionHandler

      public RecoveringProductionExceptionHandler()
  • Method Details

    • handleError

      public org.apache.kafka.streams.errors.ProductionExceptionHandler.Response handleError(org.apache.kafka.streams.errors.ErrorHandlerContext context, org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> record, Exception exception)
      Specified by:
      handleError in interface org.apache.kafka.streams.errors.ProductionExceptionHandler
    • handleSerializationError

      public org.apache.kafka.streams.errors.ProductionExceptionHandler.Response handleSerializationError(org.apache.kafka.streams.errors.ErrorHandlerContext context, org.apache.kafka.clients.producer.ProducerRecord record, Exception exception, org.apache.kafka.streams.errors.ProductionExceptionHandler.SerializationExceptionOrigin origin)
      Specified by:
      handleSerializationError in interface org.apache.kafka.streams.errors.ProductionExceptionHandler
    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • fail

      protected org.apache.kafka.streams.errors.ProductionExceptionHandler.Response fail()
      Create a response indicating that processing should fail.
      Specified by:
      fail in class AbstractRecoveringExceptionHandler<org.apache.kafka.streams.errors.ProductionExceptionHandler.Response>
      Returns:
      a handler-specific fail response
    • resume

      protected org.apache.kafka.streams.errors.ProductionExceptionHandler.Response resume(List<org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]>> deadLetterRecords)
      Create a response indicating that processing should resume.
      Specified by:
      resume in class AbstractRecoveringExceptionHandler<org.apache.kafka.streams.errors.ProductionExceptionHandler.Response>
      Parameters:
      deadLetterRecords - The list of dead letter records to forward to DLQ
      Returns:
      a handler-specific resume response