Requirements
kafkacat
binary needs to be available somewhere in your search path.
Quickly build using the bootsrap script: https://github.com/edenhill/kafkacat 1
[1]: If you're using OSX, the librdkafka build fails when trying to build its examples. Some work arounds are suggested here.
Usage
node-kafkacat
turns the kafkacat C library into node streams. There is one difference between the consume stream and a typical readable stream, and that is the .end
method which just kills the kakfacat
process.
Refer to the tests for usage examples: https://github.com/Rafflecopter/node-kafkacat/blob/master/tests/index.js
The mapping of option keys passed to the stream constructor to kafkacat command-line arguments is documented in code here. Any extra settings as documented in kafkacat can be passed as well. node-kafkacat
will take care of formatting them as -X key=val
when calling kafkacat.