Kafka: a non-idempotent producer reorders on retry

With retries enabled and more than one request in flight, a failed batch is resent behind batches that already succeeded. The records arrive in the log in an order the producer never sent - and duplicates too.

Full code & output

This topic is available to PRO members.

Sign in Create a free account

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25