kafkajs
Version:
A modern Apache Kafka client for node.js
29 lines (25 loc) • 756 B
JavaScript
const { parse, decode: decodeV0 } = require('../v0/response')
/**
* Starting 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
*
* AddPartitionsToTxn Response (Version: 1) => throttle_time_ms [errors]
* throttle_time_ms => INT32
* errors => topic [partition_errors]
* topic => STRING
* partition_errors => partition error_code
* partition => INT32
* error_code => INT16
*/
const decode = async rawData => {
const decoded = await decodeV0(rawData)
return {
...decoded,
throttleTime: 0,
clientSideThrottleTime: decoded.throttleTime,
}
}
module.exports = {
decode,
parse,
}