Writing Twice a record in Kafka is problematic, making the consumer process a record twice !
If the sequence number is incorrect and duplicated, the broker will ignore the duplicated record and it won’t write the record again.
How to enable the Idempotent Producer
props.put("enable.idempotence", "1"l); //enable idempotence