[Spring Boot] Unit Testing Kafka Producer with Producer Callback
This article covers how to write unit tests for Kafka Producers with callbacks. Callbacks can be useful to handle success cases and failure cases because Kafka Producers are asynchronous.
send()method is asynchronous. When called it adds the record to a buffer of pending record sends and immediately returns. This allows the producer to batch together individual records for efficiency.
Full source can be found at:
How to write Unit test case for adding callback for ListenableFuture
I am trying to write the unit test case for ListenableFuture adding Callback but I am not sure how to do it. Didn`t get…