0.0.11 • Published 10 years ago
node-kafka v0.0.11
node-kafka
Node.js binding for librdkafka. At this time, only the version of V8 included in node 0.10.x is supported.
Only connect and produce are implemented so far. consume will be forthcoming (but no immediate need)
KAFKA SETUP
Tested with kafka_2.8.0-0.8.0-beta1
From kafka folder
start servers
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.propertiescreate topic
bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 1 --partition 1 --topic testcheck topic
bin/kafka-list-topic.sh --zookeeper localhost:2181consumer
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginningtest producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testBUILD
Configure
node-gyp configureInitial build
node-gyp buildRebuild
node-gyp rebuildEXAMPLE
var kafka = require("./lib/kafka");
var producer = new kafka.Producer({
brokers: "localhost:9092",
partition: 0,
topic: "test"
});
producer.connect(function() {
producer.send('message', 0, function(err) {
...
}).on("sent", function(err) {
...
}).on("delivery", function(err, length) {
...
}).on("error", function(err) {
...
});
})TEST
node example.js
node example2.jsLICENSE
See LICENSE, and LICENSE.* for dependencies