GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - reemdiab/node-kafka-zookeeper: A high-level client library in Node.js for the Apache Kafka project with Zookeeper integration

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
index.js
index.js
 
 
package.json
package.json
 
 

Repository files navigation

node-kafka-zookeeper

A high-level client library in Node.js for the Apache Kafka project with Zookeeper integration

Kafka is a persistent, efficient, distributed publish/subscribe messaging system.
Prozess is a Kafka client library used for low-level access from node-kafka-zookeeper.

###Consumer example:

A Kafkazoo object handles broker enumeration and offset storage

var Kafkazoo = require('kafka-zookeeper').Kafkazoo;
var kafka = new Kafkazoo({
  host: 'localhost',
  port: 2181,
  zkPath: '/'
});

var onMessages = function (error, messages, acknowledge) {
    if (error) return log.error(error);
    // log some details
    log.info('Received %d messages', messages.length);
    log.debug(messages[0].substring(0, 100) + '...');

    // and get next batch
    acknowledge(true); // false will resend the same messages after a delay
};

// Start consuming
kafka.consume('MessageHeaders', 'dcrouse', onMessages);

// Stop consuming

###Utility examples:

The Kafkazoo object also exposes some utility functions - used internally and useful for testing

var _ = require('underscore');
var Kafkazoo = require('kafka-zookeeper');

var kafka = new Kafkazoo({
  host: 'localhost',
  port: 2181
});

var topic = 'KafkaTopic', group = 'ConsumerGroup';

// Retrieve all consumer offsets for topic/group
var onConsumerOffsets = function(offsets, error) {
  if (error) return console.error('onConsumerOffsets', error);
  console.log('Offsets', offsets);
};

kafka.getConsumerOffsets(topic, group, onConsumerOffsets);

// Initialize consumer offsets
var onInitializeConsumerOffsets = function(error) {
  if (error) return console.error('onInitializeConsumerOffsets', error);
  console.log('Consumer offsets initialized');
};

kafka.initializeConsumerOffsets(topic, group, onInitializeConsumerOffsets);

###Installation:

npm install kafka-zookeeper

###Checkout the code and run the tests:

git clone https://github.com/devoncrouse/node-kafka-zookeeper.git
cd node-kafka-zookeeper; npm test

###Kafka Compatability matrix:

Kakfa 0.8.0 ReleaseNot Supported
Kafka 0.7.2 ReleaseSupported
Kafka 0.7.1 ReleaseSupported
Kafka 0.7.0 ReleaseSupported
kafka-0.6Consumer-only support.
kafka-0.05Not Supported

Versions taken from http://incubator.apache.org/kafka/downloads.html

About

A high-level client library in Node.js for the Apache Kafka project with Zookeeper integration

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.