rsmq-worker
Advanced tools
Comparing version 0.4.3 to 0.5.0
(function() { | ||
exports.version = '0.4.2'; | ||
exports.version = '0.5.0'; | ||
@@ -4,0 +4,0 @@ module.exports = require('./lib/rsmq-worker'); |
@@ -71,2 +71,4 @@ (function() { | ||
this._initRSMQ = bind(this._initRSMQ, this); | ||
this.size = bind(this.size, this); | ||
this.info = bind(this.info, this); | ||
this.changeInterval = bind(this.changeInterval, this); | ||
@@ -271,2 +273,73 @@ this.del = bind(this.del, this); | ||
/* | ||
## info | ||
`RSMQWorker.info( cb )` | ||
Get the queue attributes | ||
@param { Function } cb The callback function | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
*/ | ||
RSMQWorker.prototype.info = function(cb) { | ||
this.queue.getQueueAttributes({ | ||
qname: this.queuename | ||
}, (function(_this) { | ||
return function(err, resp) { | ||
if (err) { | ||
_this.error("queue info", err); | ||
cb(err); | ||
return; | ||
} | ||
cb(null, resp); | ||
}; | ||
})(this)); | ||
return this; | ||
}; | ||
/* | ||
## size | ||
`RSMQWorker.size( hidden, cb )` | ||
Get the queue size. | ||
@param { Boolean } [hidden=false] Get the message count of the queue including the currently hidden/"in flight" messages. | ||
@param { Function } cb The callback function | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
*/ | ||
RSMQWorker.prototype.size = function() { | ||
var arg, cb, hidden, i; | ||
arg = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), cb = arguments[i++]; | ||
hidden = arg[0]; | ||
this.queue.getQueueAttributes({ | ||
qname: this.queuename | ||
}, (function(_this) { | ||
return function(err, resp) { | ||
var _size; | ||
if (err) { | ||
_this.error("queue size", err); | ||
cb(err); | ||
return; | ||
} | ||
_size = (resp != null ? resp.msgs : void 0) || 0; | ||
if (hidden === true) { | ||
_size = resp.hiddenmsgs || 0; | ||
} | ||
cb(null, _size); | ||
}; | ||
})(this)); | ||
return this; | ||
}; | ||
/* | ||
## _initRSMQ | ||
@@ -273,0 +346,0 @@ |
{ | ||
"name": "rsmq-worker", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"description": "RSMQ helper to simply implement a worker around the message queue", | ||
@@ -26,3 +26,3 @@ "keywords": [], | ||
"dependencies": { | ||
"async": "1.5.x", | ||
"async": "2.0.x", | ||
"lodash": "4.x", | ||
@@ -33,11 +33,12 @@ "mpbasic": "0.0.x", | ||
"devDependencies": { | ||
"should": "9.x", | ||
"grunt": "1.x", | ||
"grunt-contrib-clean": "1.x", | ||
"grunt-contrib-coffee": "1.x", | ||
"grunt-contrib-watch": "1.x", | ||
"grunt-contrib-coffee": "1.x", | ||
"grunt-docker": "0.x", | ||
"grunt-include-replace": "4.x", | ||
"grunt-mocha-cli": "2.x", | ||
"grunt-docker": "0.x", | ||
"grunt-contrib-clean": "1.x" | ||
"randoms": "0.x", | ||
"should": "9.x" | ||
} | ||
} |
@@ -149,2 +149,24 @@ ![RSMQ-Worker](https://trello-attachments.s3.amazonaws.com/5481963992d9ba3848568a1b/600x194/61b3b6117eeb0881c919c6996adb2620/rsmq_worker_small.png) | ||
### `.info( cb )` | ||
Get the current queue attributes. | ||
This is just a shortcut to the [`rsmq.getQueueAttributes`](https://github.com/smrchy/rsmq#getqueueattributes). | ||
**Arguments** | ||
* `cb` : *( `Function` )*: Callback with `( err, attributes )`. See [rsmq-docs](https://github.com/smrchy/rsmq#getqueueattributes) for details. | ||
### `.size( [hidden=false], cb )` | ||
Get the current queue size. | ||
**Arguments** | ||
* `hidden` : *( `Boolean` optional; default = `false` )*: The count of messages including the currently hidden/"in flight" messages. | ||
* `cb` : *( `Function` optional )*: Callback with `( err, size )`. The `size` is a `Number` and repersents the number of messages in the queue. If `hidden=true` you will receive the numebr of currently hidden messages | ||
**Return** | ||
*( Self )*: The instance itself for chaining. | ||
## Events | ||
@@ -313,2 +335,3 @@ | ||
|:--:|:--:|:--| | ||
|0.5.0|2016-07-14|Added methods `.info(cb)` ([Issue#17](https://github.com/mpneuried/rsmq-worker/issues/17)) and `.size( [hidden,] cb )`| | ||
|0.4.3|2016-06-20|Optimized event listeners [Issue#15](https://github.com/mpneuried/rsmq-worker/issues/15). Thanks to [Kevin Turner](https://github.com/kpturner )| | ||
@@ -315,0 +338,0 @@ |0.4.2|2016-05-06|Added the `.quit()` function [Issue#11](https://github.com/mpneuried/rsmq-worker/issues/11). Thanks to [Sam Fung](https://github.com/5amfung )| |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44093
789
385
9
+ Addedasync@2.0.1(transitive)
- Removedasync@1.5.2(transitive)
Updatedasync@2.0.x