NOT MAINTAINED. See below:
JavaScript
Switch branches/tags
Permalink
Failed to load latest commit information.
examples extra refactoring that I missed Aug 27, 2011
lib Update lib/Consumer.js Nov 4, 2012
.gitignore gitignore node_modules and .svn Apr 16, 2012
Changelog
LICENSE Migrate from https://github.com/marcuswestin/kafka/tree/master/client… Mar 31, 2011
README.md Update non-maintenance note Oct 2, 2013
kafka.js refactored names to make more sense Aug 27, 2011
package.json v0.2.3 Dec 9, 2012

README.md

NOT MAINTAINED

I'm no longer maintaining node-kafka.

Check out on of the following node-kafka branches:

Or use Prozess, another node.js kafka library:

Legacy notes:

Kafka javascript API

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

Get up and running

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(topic, 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,
	pollInterval:  2000,
	maxSize:       1048576 // 1MB
})
consumer.on('message', function(topic, message) { 
    console.log(message)
})
consumer.connect(function() {
    consumer.subscribeTopic({name: 'test', partition: 0})
})

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')
})

Authors

  • Marcus Westin (clover)
  • Taylor Gautier (tagged)

Contributors

  • Laurie Harper
  • @omnichuck
  • @philips