A node client for Kafka
JavaScript
Pull request Compare This branch is 43 commits behind marcuswestin:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
node_modules/std
Changelog
LICENSE
README.md
kafka.js
package.json

README.md

Kafka javascript API

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

Get up and running

Install kafka npm install kafka Start zookeeper, kafka server, and a consumer // see http://sna-projects.com/kafka/quickstart.php Publish and consume some messages! var kafka = require('kafka')

new kafka.Consumer().connect().on('message', function(message) {
    console.log("Consumed message:", message)
})

var producer = new kafka.Producer().connect().on('connect', function() {
    producer.send("hey!")
    producer.close()
})

API

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

kafka.Producer 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') })