I am using the KafkaJS to create the topics.
const kafka = new Kafka({
connectionTimeout: 10_000,
authenticationTimeout: 10_000,
brokers: [`HOST_NAME:9092`],
clientId: 'example-producer',
ssl: {
servername: 'HOST_NAME',
rejectUnauthorized: false
},
sasl: {
mechanism: 'plain',
username: '*******',
password: '******'
}
})
const admin = kafka.admin();
await admin.connect()
const topic = 'test-topics';
const run = async () => {
await admin.connect()
await admin.createTopics({
topics: [{ topic }],
waitForLeaders: true,
})
await admin.createPartitions({
topicPartitions: [{ topic: topic, count: 1}],
})
}
run().catch(e => kafka.logger().error(`[Kafka-config] ${e.message}`, { stack: e.stack }));
Getting below error:
message":"[Connection] Response CreateTopics(key: 19, version: 3)","broker":"HOST_NAME:9092","clientId":"example-producer","error":"Request parameters do not satisfy the configured policy","correlationId":3,"size":58}
But when I tried to list the topic present in the cluster I am getting successful responses as Topic already exist.