2.1.5 • Published 7 months ago
@invisible/kafka v2.1.5
@invisible/kafka
Usage
import { makeKafkaInstance, TOPICS } from '@invisible/kafka'
const { consumerFactory, producerFactory, start, stop } = makeKafkaInstance({
clientId: 'testy',
brokers: ['localhost:9092'],
})
consumerFactory({
topic: TOPICS.INSTANCE_UPDATED,
runEachMessage: async (args: EachMessagePayload) => {
console.log(`Instance ${message.value} just got updated.`)
}
})
const { producer } = producerFactory()
(async () => {
await start()
await producer.send({ topic: TOPICS.INSTANCE_UPDATED, messages: [ { value: Math.round(Math.random()*100) } ] })
await stop()
})()
Tips
Make sure to also set up safe-stop events:
process
.on('exit', stop)
.on('SIGINT', stop)
.on('uncaughtException', stop)
.on('unhandledRejection', stop)
2.1.4
7 months ago
2.1.5
7 months ago
2.1.3
2 years ago
2.1.1
3 years ago
2.1.0
3 years ago
2.0.15
3 years ago
2.0.14
3 years ago
2.0.12
4 years ago
2.0.11
4 years ago
2.0.10
4 years ago
2.0.9
4 years ago
2.0.8
4 years ago
2.0.7
4 years ago
2.0.6
4 years ago
2.0.5
5 years ago
2.0.4
5 years ago
2.0.3
5 years ago
2.0.2
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago