ayoukhananov commented on a change in pull request #10951:
URL: https://github.com/apache/kafka/pull/10951#discussion_r662049082



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
##########
@@ -982,8 +982,12 @@ private void throwIfProducerClosed() {
             // for other exceptions throw directly
         } catch (ApiException e) {
             log.debug("Exception occurred during message send:", e);
-            if (callback != null)
-                callback.onCompletion(null, e);
+            // producer callback will make sure to call both 'callback' and 
interceptor callback
+            Callback interceptCallback = new InterceptorCallback<>(callback, 
this.interceptors, tp);

Review comment:
       I am not sure it covers the case KafkaException is thrown in line 913.
     throw new KafkaException("Producer closed while send in progress", e);
     
     Which means tp still not initialised and has the null value.




-- 
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