soceanainn commented on pull request #11482:
URL: https://github.com/apache/kafka/pull/11482#issuecomment-965889575


   @junrao thanks, I'll try to create a KIP tomorrow.
   
   I've added a test for the ApiException case, however for the other case 
(using `InterceptorCallback`), I can't find a way to test it from the 
KafkaProducer class.
   
   It's easier to test from the 'ProducerBatch' side of things, but this leads 
to complications since it is testing that metadata is correctly set to null 
(e.g. [here](
   
https://github.com/apache/kafka/blob/trunk/clients/src/test/java/org/apache/kafka/clients/producer/internals/ProducerBatchTest.java#L125)).
   
   The easiest fix is to make InterceptorCallback accessible at the package 
level, and update the ProducerBatch method to accept InterceptorCallback as 
input instead of Callback. That way it would make this implicit conversion from 
null metadata to an 'empty' record more obvious, and allow us to write proper 
unit tests around this. What do you think?


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to