opnotiq
v0.0.12
Published
Handle actions against operations and notifications queues
Downloads
7
Maintainers
Readme
opnotiq
opnotiq is a component to handle actions against operations and notifications queues, a simple pattern we use for decoupling work load from API requests, for accepting operations via non-api calls (i.e through a GCM upstream message) and notify when it's done.
Usage
var queues = require('queues');
var options = {
token: 'xxxxxxxx'
project_id: 'xxxxxxxx'
}
// init queue provider
var provider = queues.iron(options);
// init optoniq
var opnotiq = require('opnotiq')(provider);
opnotiq.on('notification', function(msg) {
// handle notification
});
opnotiq.postOperation('update-task', {
// op specific data
}, function(){
// callback
});
opnotiq.postNotification('attach-project', 9349, {
// notification specific data
}, function(){
// callback
});