Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _internalCallback = (err, arg) => {
if (err) {
if(err instanceof kafkaErrors.TopicsNotExistError) {
this._producer.createTopics([topic], false, (err) => {
if(err) {
// Error creating topic:
origCallback(err)
return
}
// Topic created, retry:
methodCallback(origCallback)
})
return
}
// Sometimes kafka will throw a strange error in the form of an Array.
// This is probably related to the deployment of the actual kafka
// or zookeeper service as it only happens once, when the server hasn't
// been accessed for a while.