INNER CODE UNIT · JavaScript
deleteTopics
tulios/kafkajs · src/admin/index.js:249
const deleteTopics = async ({ topics, timeout }) => {
if (!topics || !Array.isArray(topics)) {
throw new KafkaJSNonRetriableError(`Invalid topics array ${topics}`)
}
if (topics.filter(topic => typeof topic !== 'string').length > 0) {
throw new KafkaJSNonRetriableError('Invalid topics array, the names must be a valid string')
}
const retrier = createRetry(retry)
return retrier(async (bail, retryCount, retryTime) => {
try {
await cluster.refreshMetadata()
const broker = await cluster.findControllerBroker()
await broker.deleteTopics({ topics, timeout })
// Remove deleted topics