Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
kafka library for node.js
tree: 5a7516b6fb

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE
Makefile
README.md
consume_test.js
index.js
package.json
produce_test.js

README.md

Prozess

Build
Status

Prozess is a Kafka library for node.js

Kafka is a persistent, efficient, distributed publish/subscribe messaging system.

There are two low-level clients: The Producer and the Consumer:

Producer example:

var Producer = require('Prozess').Producer;

var producer = new Producer('social', {host : 'localhost'});
producer.connect(function(err){
  if (err) {  throw err; }
  console.log("producing for ", producer.topic);
  setInterval(function(){
    var message = { "thisisa" :  "test " + new Date()};
    producer.send(JSON.stringify(message));
  }, 1000);
});

Consumer example:

var Consumer = require('Prozess').Consumer;

var options = {host : 'localhost', topic : 'social', partition : 0, offset : 0};
var consumer = new Consumer(options);
consumer.connect(function(){
  console.log("connected!!");
  setInterval(function(){
    console.log("===================================================================");
    console.log(new Date());
    console.log("consuming: " + consumer.topic);
    consumer.consume(function(err, messages){
      console.log(err, messages);
    });
  }, 7000);
});

You have to be running Zookeeper and Kafka for this to work, of course.

Something went wrong with that request. Please try again.