A node client for Kafka that works

Interact with Kafka, LinkedIn's disk based message queue.

Based on marcuswestin/node-kafka -> tagged/node-kafka.

You'll need the libgmp source to compile this package. Under Debian-based systems,

sudo aptitude install libgmp3-dev

On a Mac with Homebrew,

brew install gmp

1 Install kafka

npm install kafka

2 Start zookeeper, kafka server, and a consumer (see http://sna-projects.com/kafka/quickstart.php)

3 Publish and consume some messages!

    var kafka = require('kafka')
    new kafka.Consumer().connect().subscribeTopic('test').on('message', function(topicmessage) {
        console.log("Consumed message:", message)
    var producer = new kafka.Producer().connect().on('connect', function() {


    var consumer = new kafka.Consumer({
        // these are the default values 
        host:         'localhost',
        port:          9092,
        pollInterval:  2000,
        maxSize:       1048576 // 1MB 
    consumer.on('message', function(topicmessage) { 
    consumer.connect(function() {
        consumer.subscribeTopic({name: 'test', partition: 0})


    var producer = new kafka.Producer({
        // these are also the default values 
        host:         'localhost',
        port:         9092,
        topic:        'test',
        partition:    0
    producer.connect(function() {
        producer.send('message bytes')