Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    node-kafkapublic

    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.properties

    create topic

    bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 1 --partition 1 --topic test

    check topic

    bin/kafka-list-topic.sh --zookeeper localhost:2181

    consumer

    bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

    test producer

    bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

    BUILD

    Configure

    node-gyp configure

    Initial build

    node-gyp build

    Rebuild

    node-gyp rebuild

    EXAMPLE

    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.js

    LICENSE

    See LICENSE, and LICENSE.* for dependencies

    Keywords

    none

    install

    npm i node-kafka

    Downloadsweekly downloads

    24

    version

    0.0.11

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar