kafkajs
Version:
A modern Apache Kafka client for node.js
40 lines (35 loc) • 1.25 kB
JavaScript
const { parse, decode: decodeV1 } = require('../v1/response')
/**
* Starting in version 2, on quota violation, brokers send out responses before throttling.
* @see https://cwiki.apache.org/confluence/display/KAFKA/KIP-219+-+Improve+quota+communication
*
* DescribeConfigs Response (Version: 2) => throttle_time_ms [resources]
* throttle_time_ms => INT32
* resources => error_code error_message resource_type resource_name [config_entries]
* error_code => INT16
* error_message => NULLABLE_STRING
* resource_type => INT8
* resource_name => STRING
* config_entries => config_name config_value read_only config_source is_sensitive [config_synonyms]
* config_name => STRING
* config_value => NULLABLE_STRING
* read_only => BOOLEAN
* config_source => INT8
* is_sensitive => BOOLEAN
* config_synonyms => config_name config_value config_source
* config_name => STRING
* config_value => NULLABLE_STRING
* config_source => INT8
*/
const decode = async rawData => {
const decoded = await decodeV1(rawData)
return {
...decoded,
throttleTime: 0,
clientSideThrottleTime: decoded.throttleTime,
}
}
module.exports = {
decode,
parse,
}