kafka-ts
Version:
**KafkaTS** is a Apache Kafka client library for Node.js. It provides both a low-level API for communicating directly with the Apache Kafka cluster and high-level APIs for publishing and subscribing to Kafka topics.
30 lines (28 loc) • 922 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SASL_HANDSHAKE = void 0;
const api_1 = require("../utils/api");
const error_1 = require("../utils/error");
/*
SaslHandshake Request (Version: 1) => mechanism
mechanism => STRING
SaslHandshake Response (Version: 1) => error_code [mechanisms]
error_code => INT16
mechanisms => STRING
*/
exports.SASL_HANDSHAKE = (0, api_1.createApi)({
apiKey: 17,
apiVersion: 1,
requestHeaderVersion: 1,
responseHeaderVersion: 0,
request: (encoder, data) => encoder.writeString(data.mechanism),
response: (decoder) => {
const result = {
errorCode: decoder.readInt16(),
mechanisms: decoder.readArray((mechanism) => mechanism.readString()),
};
if (result.errorCode)
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
return result;
},
});