Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Default Dead letter queue record

Key

Key of the input message, null if triggered by punctuate

Value

  • If available, contains the value of the input message
  • If triggered by punctuate, "error during punctuate"
  • If messages exceed Kafka maximum size "message exceeding Kafka maximum record size"

Header: exception

Name of the thrown exception

Header: stacktrace

Stacktrace of the thrown exception 

Header: message

Thrown exception message

Header: topic

Source input topic, null if triggered by punctuate

Header: partition

Source input partition, null if triggered by punctuate

Header: offset

Source input offset, null if triggered by punctuate


Public Interfaces

StreamsConfig.java

...

Code Block
languagejava
public interface DeserializationExceptionHandler extends Configurable {


   /**
    * Inspect a record and the exception received.
    * <p>
    * Note, that the passed in {@link ProcessorContext} only allows to access metadata like the task ID.
    * However, it cannot be used to emit records via {@link ProcessorContext#forward(Object, Object)};
    * calling {@code forward()} (and some other methods) would result in a runtime exception.
    *
    * @param context processor context
    * @param record record that failed deserialization
    * @param exception the actual exception
    */
   @SuppressWarnings("deprecation") // Old PAPI. Needs to be migrated.
   DeserializationHandlerResponse handle(final ProcessorContext context,
                                         final ConsumerRecord<byte[], byte[]> record,
                                         final Exception exception);
...

   /**
    * Enumeration that describes the response from the exception handler.
    */
   enum DeserializationHandlerResponse {
        . . .

       public DeserializationHandlerResponse withDeadLetterQueueRecord(ProducerRecord<byte[], byte[]> deadLetterQueueRecord, String deadLetterQueueTopicName) {
           this.deadLetterQueueRecord = deadLetterQueueRecord;
           return this;
       }
   }
}

...