transactional.id — Kafka Producer Configuration
The TransactionalId to use for transactional delivery. This enables reliability semantics which span multiple producer sessions since it allows the client to guarantee that transactions using the same TransactionalId have been completed prior to starting any new transactions.
Description
The TransactionalId to use for transactional delivery. This enables reliability semantics which span multiple producer sessions since it allows the client to guarantee that transactions using the same TransactionalId have been completed prior to starting any new transactions. If no TransactionalId is provided, then the producer is limited to idempotent delivery. If a TransactionalId is configured, enable.idempotence is implied. By default the TransactionId is not configured, which means transactions cannot be used. Note that, by default, transactions require a cluster of at least three brokers which is the recommended setting for production; for development you can change this, by adjusting broker setting transaction.state.log.replication.factor.
Default Values by Kafka Version
| Kafka Version | Default Value |
|---|---|
| 0.11.0 | null |
| 1.0 | null |
| 1.1 | null |
| 2.0 | null |
| 2.1 | null |
| 2.2 | null |
| 2.3 | null |
| 2.4 | null |
| 2.5 | null |
| 2.6 | null |
| 2.7 | null |
| 2.8 | null |
| 3.0 | null |
| 3.1 | null |
| 3.2 | null |
| 3.3 | null |
| 3.4 | null |
| 3.5 | null |
| 3.6 | null |
| 3.7 | null |
| 3.8 | null |
| 3.9 | null |
| 4.0 | null |
| 4.1 | null |
| 4.2 | null |
Tuning Recommendation
| Profile | Recommended | Why |
|---|---|---|
| producer / durability | "<app-name>-<instance-id>" | Setting a stable transactional.id enables the transactional API (beginTransaction/commitTransaction/abortTransaction), which provides atomic writes across multiple partitions and topics; consumers with isolation.level=read_committed see only committed records. The ID must be unique per producer instance and stable across restarts to allow epoch fencing of zombie producers. |
Related Configs
enable.idempotence · acks · transaction.timeout.ms