Skip to content
m manifester.io
All Kafka APIs

WriteTxnMarkers

This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 1 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.

API key
27
Encoded at
v1
Flexible versions
1+
Headers
req v2, resp v1
Request versions
1
Response versions
1
Request size
41 bytes
Response size
31 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields

Request

WriteTxnMarkersRequest v1, request header v2, 41 bytes on the wire

byte layout (41 bytes, 16 bytes per row)

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020

object tree

WriteTxnMarkersRequest                         message v1                                         [0x0000, 41B]
+-- Frame                                                                                         [0x0000, 4B]   length-delimited framing
|   +-- size                                   int32                     = 37                     [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- RequestHeader                              v2                                                 [0x0004, 11B]  common request header
|   +-- request_api_key                        int16                     = 27 (WriteTxnMarkers)   [0x0004, 2B]   numeric id of the API being invoked
|   +-- request_api_version                    int16                     = 1                      [0x0006, 2B]   version of the API being invoked
|   +-- correlation_id                         int32                     = 0                      [0x0008, 4B]   echoed back by the broker in the response
|   +-- client_id                              nullable_string           = "" (int16 len=0)       [0x000c, 2B]   always a non-flexible int16-prefixed string
|   +-- tagged_fields                          uvarint                   = 0                      [0x000e, 1B]   number of tagged fields in the header
+-- WriteTxnMarkersRequest                     struct                                             [0x000f, 26B]  message body, version 1
    +-- Markers                                []WritableTxnMarker       = 1 element              [0x000f, 25B]  The transaction markers to be written.
    |   +-- length                             uvarint                   = 2 (compact, n+1)       [0x000f, 1B]   one sample element follows
    |   +-- WritableTxnMarker[0]               WritableTxnMarker         = struct                 [0x0010, 24B]
    |       +-- ProducerId                     int64                     = 0                      [0x0010, 8B]   The current producer ID.
    |       +-- ProducerEpoch                  int16                     = 0                      [0x0018, 2B]   The current epoch associated with the producer ID.
    |       +-- TransactionResult              bool                      = false                  [0x001a, 1B]   The result of the transaction to write to the partitions (false = ABORT, tr...
    |       +-- Topics                         []WritableTxnMarkerTopic  = 1 element              [0x001b, 8B]   Each topic that we want to write transaction marker(s) for.
    |       |   +-- length                     uvarint                   = 2 (compact, n+1)       [0x001b, 1B]   one sample element follows
    |       |   +-- WritableTxnMarkerTopic[0]  WritableTxnMarkerTopic    = struct                 [0x001c, 7B]
    |       |       +-- Name                   string                    = "" (compact, len+1=1)  [0x001c, 1B]   The topic name.
    |       |       +-- PartitionIndexes       []int32                   = 1 element              [0x001d, 5B]   The indexes of the partitions to write transaction markers for.
    |       |       |   +-- length             uvarint                   = 2 (compact, n+1)       [0x001d, 1B]   one sample element follows
    |       |       |   +-- int32[0]           int32                     = 0                      [0x001e, 4B]
    |       |       +-- tagged_fields          uvarint                   = 0                      [0x0022, 1B]   number of tagged fields in this struct
    |       +-- CoordinatorEpoch               int32                     = 0                      [0x0023, 4B]   Epoch associated with the transaction state partition hosted by this transa...
    |       +-- tagged_fields                  uvarint                   = 0                      [0x0027, 1B]   number of tagged fields in this struct
    +-- tagged_fields                          uvarint                   = 0                      [0x0028, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 27,
  "type": "request",
  "listeners": ["broker"],
  "name": "WriteTxnMarkersRequest",
  // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline.
  //
  // Version 1 enables flexible versions.
  "validVersions": "1",
  "flexibleVersions": "1+",
  "fields": [
    { "name": "Markers", "type": "[]WritableTxnMarker", "versions": "0+",
      "about": "The transaction markers to be written.", "fields": [
      { "name": "ProducerId", "type": "int64", "versions": "0+", "entityType": "producerId",
        "about": "The current producer ID."},
      { "name": "ProducerEpoch", "type": "int16", "versions": "0+",
        "about": "The current epoch associated with the producer ID." },
      { "name": "TransactionResult", "type": "bool", "versions": "0+",
        "about": "The result of the transaction to write to the partitions (false = ABORT, true = COMMIT)." },
      { "name": "Topics", "type": "[]WritableTxnMarkerTopic", "versions": "0+",
        "about": "Each topic that we want to write transaction marker(s) for.", "fields": [
        { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName",
          "about": "The topic name." },
        { "name": "PartitionIndexes", "type": "[]int32", "versions": "0+",
          "about": "The indexes of the partitions to write transaction markers for." }
      ]},
      { "name": "CoordinatorEpoch", "type": "int32", "versions": "0+",
        "about": "Epoch associated with the transaction state partition hosted by this transaction coordinator." }
    ]}
  ]
}

Response

WriteTxnMarkersResponse v1, response header v1, 31 bytes on the wire

byte layout (31 bytes, 16 bytes per row)

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010

object tree

WriteTxnMarkersResponse                                          message v1                                                   [0x0000, 31B]
+-- Frame                                                                                                                     [0x0000, 4B]   length-delimited framing
|   +-- size                                                     int32                               = 27                     [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- ResponseHeader                                               v1                                                           [0x0004, 5B]   common response header
|   +-- correlation_id                                           int32                               = 0                      [0x0004, 4B]   matches the correlation_id of the request
|   +-- tagged_fields                                            uvarint                             = 0                      [0x0008, 1B]   number of tagged fields in the header
+-- WriteTxnMarkersResponse                                      struct                                                       [0x0009, 22B]  message body, version 1
    +-- Markers                                                  []WritableTxnMarkerResult           = 1 element              [0x0009, 21B]  The results for writing makers.
    |   +-- length                                               uvarint                             = 2 (compact, n+1)       [0x0009, 1B]   one sample element follows
    |   +-- WritableTxnMarkerResult[0]                           WritableTxnMarkerResult             = struct                 [0x000a, 20B]
    |       +-- ProducerId                                       int64                               = 0                      [0x000a, 8B]   The current producer ID in use by the transactional ID.
    |       +-- Topics                                           []WritableTxnMarkerTopicResult      = 1 element              [0x0012, 11B]  The results by topic.
    |       |   +-- length                                       uvarint                             = 2 (compact, n+1)       [0x0012, 1B]   one sample element follows
    |       |   +-- WritableTxnMarkerTopicResult[0]              WritableTxnMarkerTopicResult        = struct                 [0x0013, 10B]
    |       |       +-- Name                                     string                              = "" (compact, len+1=1)  [0x0013, 1B]   The topic name.
    |       |       +-- Partitions                               []WritableTxnMarkerPartitionResult  = 1 element              [0x0014, 8B]   The results by partition.
    |       |       |   +-- length                               uvarint                             = 2 (compact, n+1)       [0x0014, 1B]   one sample element follows
    |       |       |   +-- WritableTxnMarkerPartitionResult[0]  WritableTxnMarkerPartitionResult    = struct                 [0x0015, 7B]
    |       |       |       +-- PartitionIndex                   int32                               = 0                      [0x0015, 4B]   The partition index.
    |       |       |       +-- ErrorCode                        int16                               = 0                      [0x0019, 2B]   The error code, or 0 if there was no error.
    |       |       |       +-- tagged_fields                    uvarint                             = 0                      [0x001b, 1B]   number of tagged fields in this struct
    |       |       +-- tagged_fields                            uvarint                             = 0                      [0x001c, 1B]   number of tagged fields in this struct
    |       +-- tagged_fields                                    uvarint                             = 0                      [0x001d, 1B]   number of tagged fields in this struct
    +-- tagged_fields                                            uvarint                             = 0                      [0x001e, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 27,
  "type": "response",
  "name": "WriteTxnMarkersResponse",
  "validVersions": "1",
  // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline.
  //
  // Version 1 enables flexible versions.
  "flexibleVersions": "1+",
  "fields": [
    { "name": "Markers", "type": "[]WritableTxnMarkerResult", "versions": "0+",
      "about": "The results for writing makers.", "fields": [
      { "name": "ProducerId", "type": "int64", "versions": "0+", "entityType": "producerId",
        "about": "The current producer ID in use by the transactional ID." },
      { "name": "Topics", "type": "[]WritableTxnMarkerTopicResult", "versions": "0+",
        "about": "The results by topic.", "fields": [
        { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName",
          "about": "The topic name." },
        { "name": "Partitions", "type": "[]WritableTxnMarkerPartitionResult", "versions": "0+",
          "about": "The results by partition.", "fields": [
          { "name": "PartitionIndex", "type": "int32", "versions": "0+",
            "about": "The partition index." },
          { "name": "ErrorCode", "type": "int16", "versions": "0+",
            "about": "The error code, or 0 if there was no error." }
        ]}
      ]}
    ]}
  ]
}