SuperTest -> Kafka-Penguin Readme
A readme style for kafka-penguin based of of the package, supertest: https://github.com/visionmedia/supertest
Kafka-Penguin
About
Getting Started
npm install kafka-penguinExample
//Import your kafkajs client from another file
const kafkaPenguin = require('kafka-penguin');
const devClient = require('./clientConfig.js')
const strategies = kafkaPenguin.failfast
// Initialize strategy-- passing in the # of retries and your kafkjs client
const newStrategy = new strategies.FailFast(2, devClient)
//Create a wrong topic message
const message = {
topic: 'wrong-topic',
messages: [
{key: "hello",
value: "world",
}
]
}
// Initialize producer from the failfast strategy
const producer = newStrategy.producer();
producer.connect()
.then(() => console.log('Connected!'))
.then(() => producer.send(message))
.catch((e: any) => console.log("error: ", e.message))API
.FailFast(retry, Kafka-client)
Last updated
Was this helpful?