I have a kafka producer configured with at least once delivery semantics. The challenge now is How do I actually Implement a scenario to force Kafka to retry and publish Duplicate messages? The following are some of the ideas that came to mind —- Any better ideas?
Use interceptors To throw an exception — This doesn’t work as exception does not trigger retry.
Maybe use Mockito To Stub One of the network classes In the producer API To fail the response which hopefully will trigger a retry?
Use a separate thread to temporarily disable the internet/network interface on the machine, the producer is running on?
This might sound a lame task, but we are trying to implement an exactly once Kafka processing so the above scenario will be used to test this.
Any ideas will be appreciated!