Kafka Please
This npm module lets you start up a Kafka broker (including ZooKeeper) locally. It's meant to facilitate integration tests when you need to test against a Kafka broker.
You need Java in order to run Kafka. This npm module assumes that you already have Java installed.
Usage:
npm install kafka-please --save-dev
const makeKafkaServer = ; ;
Timeouts in mocha
Typically, starting a Kafka server takes ~2-3 seconds, and can make your mocha tests time out, if you don't override the timeout:
;
Developing
- git clone this project
- run
fetch.sh
to download Kafka and unzip it - run
npm install
to get dependencies npm test
will run the integration tests.