GithubHelp home page GithubHelp logo

sirithink / node-kafka Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcuswestin/node-kafka

0.0 2.0 0.0 237 KB

NOT MAINTAINED. See below:

Home Page: https://github.com/marcuswestin/node-kafka#no-longer-maintained

License: MIT License

node-kafka's Introduction

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

node-kafka's People

Contributors

laurie71 avatar marcuswestin avatar omnichuck avatar philips avatar rbrcurtis avatar sekhar4self avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.