Versions Compared

Key

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

...

This KIP is aimed at improving the error-handling semantics in Kafka Streams when Kafka Steams fails to serialize a message to the downstream sink by providing an interface that can provide custom messaging of the error (e.g. report to a custom metrics system) and indicate to Streams whether or not it should re-throw the Exception, thus causing the application to fall over.

Status

Current state: Under Discussion Accepted

Discussion thread: here

JIRA: KAFKA-7499

...

To accept different types of records from multiple topologies, ProducerRecord is defined without generics. The above interface method will have a default implementation which returns ProductionExceptionHandlerResponse.FAIL

 Proposed Proposed Changes

This implementation will override the new method, handleSerializationException, in the following class:

...

We'll implement the following error handling logic to the send in RecordCollectorImpl. The new method, handleSerializationException, in ProductionExceptionHandler will not be invoked whenfor

  1. ClassCastException is thrown while serializing record key / value. Today, we are throwing StreamsException on hitting this exception. Whether to throw the
    exception to the user will be decided based on the response received from ProductionExceptionHandler handleSerializationException method. 
  2. If the result is CONTINUE, log a note at DEBUG that we received that result and are not failing Streams as a result.
  3. If the result is FAIL, log a message at ERROR that we received that result and throw StreamsException so Streams will fail.We will continue to throw this exception and not invoke the new method.  This will allow the current behavior to continue as this can help identify misconfigured serdes 

It will be invoked for

  1. Any other unchecked exceptions, that thrown during record key / value serialization.
    1. If the result is CONTINUE, log a note at DEBUGWARN that we received that result and are not failing Streams as a result.
    2. If the result is FAIL, log a message at ERROR that we received that result and set sendException so Streams will fail.

...