...
1// InitProducerIDRequest initializes a producer ID for idempotent transactions,
2// and if using transactions, a producer epoch. This is the first request
3// necessary to begin idempotent producing or transactions.
4//
5// Note that you do not need to go to a txn coordinator if you are initializing
6// a producer id without a transactional id.
7InitProducerIDRequest => key 22, max version 4, flexible v2+, txn coordinator
8 // TransactionalID is the ID to use for transactions if using transactions.
9 TransactionalID: nullable-string
10 // TransactionTimeoutMillis is how long a transaction is allowed before
11 // EndTxn is required.
12 //
13 // Note that this timeout only begins on the first AddPartitionsToTxn
14 // request.
15 TransactionTimeoutMillis: int32
16 // ProducerID, added for KIP-360, is the current producer ID. This allows
17 // the client to potentially recover on UNKNOWN_PRODUCER_ID errors.
18 ProducerID: int64(-1) // v3+
19 // The producer's current epoch. This will be checked against the producer
20 // epoch on the broker, and the request will return an error if they do not
21 // match. Also added for KIP-360.
22 ProducerEpoch: int16(-1) // v3+
23
24// InitProducerIDResponse is returned for an InitProducerIDRequest.
25InitProducerIDResponse =>
26 ThrottleMillis(1)
27 // CLUSTER_AUTHORIZATION_FAILED is returned when not using transactions if
28 // the client is not authorized for idempotent_write on cluster.
29 //
30 // TRANSACTIONAL_ID_AUTHORIZATION_FAILED is returned when using transactions
31 // if the client is not authorized to write on transactional_id.
32 //
33 // INVALID_REQUEST is returned if using transactions and the transactional id
34 // is an empty, non-null string
35 //
36 // COORDINATOR_LOAD_IN_PROGRESS is returned if the coordinator for this
37 // transactional ID is still loading.
38 //
39 // NOT_COORDINATOR is returned if the broker is not the coordinator for
40 // this transactional ID.
41 //
42 // INVALID_TRANSACTION_TIMEOUT is returned if using transactions and the timeout
43 // is equal to over over transaction.max.timeout.ms or under 0.
44 //
45 // CONCURRENT_TRANSACTIONS is returned if there is an ongoing transaction
46 // that is completing at the time this init is called.
47 ErrorCode: int16
48 // ProducerID is the next producer ID that Kafka generated. This ID is used
49 // to ensure repeated produce requests do not result in duplicate records.
50 ProducerID: int64(-1)
51 // ProducerEpoch is the producer epoch to use for transactions.
52 ProducerEpoch: int16
View as plain text