conduktor.io ↗

Kafka AddPartitionsToTxn Request Wire Format v5 — Binary Protocol Layout

What is AddPartitionsToTxn?

Transactional producers send this before writing to any new partition within a transaction to register it with the coordinator. CONCURRENT_TRANSACTIONS means another producer with the same transactional.id is still active and must complete or time out first.

Related Errors

CONCURRENT_TRANSACTIONS · COORDINATOR_NOT_AVAILABLE · INVALID_PRODUCER_EPOCH · INVALID_PRODUCER_ID_MAPPING · INVALID_REQUEST · INVALID_TRANSACTION_TIMEOUT · INVALID_TXN_STATE · NOT_COORDINATOR · OPERATION_NOT_ATTEMPTED · PRODUCER_FENCED · TOPIC_AUTHORIZATION_FAILED · TRANSACTIONAL_ID_AUTHORIZATION_FAILED · TRANSACTIONAL_ID_NOT_FOUND · TRANSACTION_ABORTABLE · UNKNOWN_TOPIC_OR_PARTITION · UNSUPPORTED_VERSION

Wire Diagram

Request Header · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string (compact)
tagged var
AddPartitionsToTxnRequest v5
Transactions array
tagged var
TransactionalId string (compact)
ProducerId int64 · 8B
ProducerEpoch int16 · 2B
VerifyOnly bool · 1B
Topics array
tagged var
Name string (compact)
Partitions []int32
tagged var

Schema & Example

Schema
{
  "Transactions": [{
      "TransactionalId": string,
      "ProducerId": int64,
      "ProducerEpoch": int16,
      "VerifyOnly": bool,
      "Topics": [{
          "Name": string,
          "Partitions": [int32]
      }],
      "Name": string,
      "Partitions": [int32]
  }]
}
Example
{
  "Transactions": [{
      "TransactionalId": "tx-orders-001",
      "ProducerId": 0,
      "ProducerEpoch": 12,
      "VerifyOnly": true,
      "Topics": [{
          "Name": "orders",
          "Partitions": [1, 2, 3]
      }],
      "Name": "orders",
      "Partitions": [1, 2, 3]
  }]
}