0.2.0 • Published 10 years ago

nsqubicle v0.2.0

Weekly downloads
26
License
-
Repository
github
Last release
10 years ago

nsqubicle

Wraps nsq.js into an easy to use interface

npm install nsqubicle

Usage

Read messages using pull and write messages using push

var nsq = require('nsqubicle');
var queue = nsq({
	nsqd: ['127.0.0.1:4150'],
	channel: 'my-channel'
});

queue.pull('test', function(message, callback) {
	console.log('we have pulled a message!', message);
	callback(); // we are done with the message
});

queue.push('test', {hello:'world'});

The options map is passed directly to nsq.js as well. In addition to the regular nsq options you can pass

{
	namespace: 'namespace-topics-with-me',
	broadcast: true // set to false to disable broadcasting
}

If you call the callback with an error the message will be requeued.

Broadcasting

Per default nsqubicle broadcast all messages to a broadcast topic as well. You can read these messages by calling pull without a topic

queue.pull(function(topic, message, callback) {
	console.log('someone pushed to', topic, 'with message', message);
	callback();
});

License

MIT

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago