# Idempotent producers

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: Idempotent producers
latest-operator-version: v26.1.4
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "true"
page-eol-date: July 31, 2025
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
docname: produce-data/idempotent-producers
page-component-name: streaming
page-version: "24.2"
page-component-version: "24.2"
page-component-title: Streaming
page-relative-src-path: produce-data/idempotent-producers.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/24.2/modules/develop/pages/produce-data/idempotent-producers.adoc
description: Idempotent producers assign a unique ID to every write request, guaranteeing that each message is recorded only once in the order in which it was sent.
page-git-created-date: "2023-05-30"
page-git-modified-date: "2024-07-24"
support-status: past end-of-life
---

<!-- Source: https://docs.redpanda.com/streaming/24.2/develop/produce-data/idempotent-producers.md -->

When a producer writes messages to a topic, each message should be recorded only once in the order in which it was sent. However, network issues such as a connection failure can result in a timeout, which prevents a write request from succeeding. In such cases, the client retries the write request until one of these events occurs:

-   The client receives an acknowledgment from the broker that the write was successful.

-   The retry limit is reached.

-   The message delivery timeout limit is reached.


Since there is no way to tell if the initial write request succeeded before the disruption, a retry can result in a duplicate message. A retry can also cause subsequent messages to be written out of order.

Idempotent producers prevent this problem by assigning a unique ID to every write request. The request ID consists of the producer ID and a sequence number. The sequence number identifies the order in which each write request was sent. If a retry results in a duplicate message, Redpanda detects and rejects the duplicate message and maintains the original order of the messages.

If new write requests continue while a previous request is being retried, the new requests are stored in the client’s memory in the order in which they were sent. The client must also retry these requests once the previous request is successful.

## [](#enable-idempotence-for-producers)Enable idempotence for producers

To make producers idempotent, the `enable.idempotence` property must be set to `true` in your producer configuration, as well as in the Redpanda cluster configuration, where it is set to `true` by default.

Some Kafka clients have `enable.idempotence` set to `false` by default. In this case, set the property to `true` by following the instructions for your particular client.

Idempotence is guaranteed within a session. A session starts once a producer is created and a connection is established between the client and the Kafka broker.

> 📝 **NOTE**
>
> Idempotent producers retry unsuccessful write requests automatically. If you manually retry a write request, the client will assign a new ID to that request, which may lead to duplicate messages.

To disable idempotence (and risk duplicate messages as a result of retries), set `enable_idempotence` to `false`. For instructions on how to edit any cluster property, see [Configure cluster properties](https://docs.redpanda.com/streaming/24.2/manage/cluster-maintenance/cluster-property-configuration/).

## Suggested labs

-   [Stream Stock Market Data from a CSV file Using Node.js](https://docs.redpanda.com/labs/clients/stock-market-activity-nodejs/)
-   [Stream Stock Market Data from a CSV file Using Python](https://docs.redpanda.com/labs/clients/stock-market-activity-python/)
-   [Build a Chat Room Application with Redpanda and Golang](https://docs.redpanda.com/labs/clients/docker-go/)
-   [Build a Chat Room Application with Redpanda and Java](https://docs.redpanda.com/labs/clients/docker-java/)
-   [Build a Chat Room Application with Redpanda and Node.js](https://docs.redpanda.com/labs/clients/docker-nodejs/)
-   [Build a Chat Room Application with Redpanda and Python](https://docs.redpanda.com/labs/clients/docker-python/)
-   [Build a Chat Room Application with Redpanda and Rust](https://docs.redpanda.com/labs/clients/docker-rust/)

See more

[Search all labs](https://docs.redpanda.com/labs)