hapi-nsq
Hapi-NSQ Hapi.js module for using NSQ
Lead Maintainer: Doron Segal
Introduction
If you're using Hapi.js and want to use NSQ this plugin can help you.
Example
Initializing the plugin (NSQD)
server = ;server;server;
Initializing the plugin (NSQ LOOKUP)
server = ;server;server;
Publish
const TOPIC = 'events'; //Your topic//Access plugin via server objectserverplugins'hapi-nsqjs'writer;serverplugins'hapi-nsqjs'writer; // Access the plugin via requestrequestserverplugins'hapi-nsqjs'writer;requestserverplugins'hapi-nsqjs'writer;
Subscribe using the module
// using nsq.jsexports { const reader = serverplugins'hapi-nsqjs'nsq; reader; reader;});
Subscribe Without using the module
// using nsq.jsvar nsq = ;var reader = nsq; reader;
Plugin Options:
nsqLookup
- When using nsqlookupd you need to pass an array with ip:port
- for ex'
nsqLookup: ['127.0.0.1:5000', '128.0.0.1:5000']
nsqd
- When using nsqd you need to pass host and port
- for ex'
javascript { nsqPort: 5000, nsqHost: '127.0.0.2' }
Logs
Logs will be using server.log['nsq]
NSQ Important links
- for more example using nsq.js checkout this url
- Great article by Calvin French-Owen from Segment url
API
Coming Soon