sebastienviale commented on code in PR #17942:
URL: https://github.com/apache/kafka/pull/17942#discussion_r1920322117


##########
streams/src/main/java/org/apache/kafka/streams/errors/DefaultProductionExceptionHandler.java:
##########
@@ -18,35 +18,72 @@
 
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.apache.kafka.common.errors.RetriableException;
+import org.apache.kafka.streams.StreamsConfig;
 
 import java.util.Map;
 
+import static 
org.apache.kafka.streams.errors.ExceptionHandlerUtils.maybeBuildDeadLetterQueueRecords;
+
 /**
  * {@code ProductionExceptionHandler} that always instructs streams to fail 
when an exception
  * happens while attempting to produce result records.
  */
 public class DefaultProductionExceptionHandler implements 
ProductionExceptionHandler {
+    private String deadLetterQueueTopic = null;
+
     @SuppressWarnings("deprecation")
     @Deprecated
     @Override
     public ProductionExceptionHandlerResponse handle(final 
ProducerRecord<byte[], byte[]> record,
                                                      final Exception 
exception) {
         return exception instanceof RetriableException ?
-            ProductionExceptionHandlerResponse.RETRY :
-            ProductionExceptionHandlerResponse.FAIL;
+            
ProductionExceptionHandler.ProductionExceptionHandlerResponse.RETRY :
+            ProductionExceptionHandler.ProductionExceptionHandlerResponse.FAIL;
     }
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     @Override
     public ProductionExceptionHandlerResponse handle(final ErrorHandlerContext 
context,
                                                      final 
ProducerRecord<byte[], byte[]> record,
                                                      final Exception 
exception) {
         return exception instanceof RetriableException ?
-            ProductionExceptionHandlerResponse.RETRY :
-            ProductionExceptionHandlerResponse.FAIL;
+                
ProductionExceptionHandler.ProductionExceptionHandlerResponse.RETRY :
+                
ProductionExceptionHandler.ProductionExceptionHandlerResponse.FAIL;
+    }
+
+    @Override
+    public Response handleError(final ErrorHandlerContext context,
+                                final ProducerRecord<byte[], byte[]> record,
+                                final Exception exception) {
+        return exception instanceof RetriableException ?
+            Response.retry() :
+            
Response.fail(maybeBuildDeadLetterQueueRecords(deadLetterQueueTopic, null, 
null, context, exception));
+    }
+
+
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
+    public ProductionExceptionHandlerResponse 
handleSerializationException(final ErrorHandlerContext context,
+                                                                           
final ProducerRecord record,
+                                                                           
final Exception exception,
+                                                                           
final SerializationExceptionOrigin origin) {
+        return 
ProductionExceptionHandler.ProductionExceptionHandlerResponse.FAIL;
     }

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to