kafkajs
Version:
A modern Apache Kafka client for node.js
30 lines (25 loc) • 733 B
JavaScript
const { parse, decode: decodeV1 } = require('../v0/response')
/**
* In version 1, on quota violation, brokers send out responses before throttling.
* @see https://cwiki.apache.org/confluence/display/KAFKA/KIP-219+-+Improve+quota+communication
*
* TxnOffsetCommit Response (Version: 1) => throttle_time_ms [topics]
* throttle_time_ms => INT32
* topics => topic [partitions]
* topic => STRING
* partitions => partition error_code
* partition => INT32
* error_code => INT16
*/
const decode = async rawData => {
const decoded = await decodeV1(rawData)
return {
...decoded,
throttleTime: 0,
clientSideThrottleTime: decoded.throttleTime,
}
}
module.exports = {
decode,
parse,
}