rsmq-worker
Advanced tools
Comparing version 0.3.7 to 0.3.8
(function() { | ||
exports.version = '0.3.7'; | ||
exports.version = '0.3.8'; | ||
@@ -4,0 +4,0 @@ module.exports = require('./lib/rsmq-worker'); |
@@ -17,2 +17,4 @@ (function() { | ||
RSMQWorker.prototype.stopped = false; | ||
RSMQWorker.prototype.defaults = function() { | ||
@@ -38,3 +40,3 @@ return this.extend(RSMQWorker.__super__.defaults.apply(this, arguments), { | ||
/* | ||
/* | ||
## constructor | ||
@@ -77,10 +79,10 @@ */ | ||
## start | ||
`RSMQWorker.start()` | ||
Start the worker | ||
@return { RedisSMQ } A rsmq instance | ||
@return { RedisSMQ } A rsmq instance | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@@ -92,2 +94,3 @@ @api public | ||
if (this.ready) { | ||
this.stopped = false; | ||
this.interval(); | ||
@@ -103,9 +106,9 @@ return; | ||
## stop | ||
`RSMQWorker.stop()` | ||
Stop the worker receiving messages | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
@@ -115,2 +118,3 @@ */ | ||
RSMQWorker.prototype.stop = function() { | ||
this.stopped = true; | ||
if (this.timeout != null) { | ||
@@ -125,13 +129,13 @@ clearTimeout(this.timeout); | ||
## send | ||
`RSMQWorker.send( msg [, delay] )` | ||
Helper/Convinience method to send a new message to the queue. | ||
@param { String } msg The message content | ||
@param { String } msg The message content | ||
@param { Number } [delay=0] The message delay to hide this message for the next `x` seconds. | ||
@param { Function } [cb] A optional callback to get a secure response for a successful send. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
@@ -167,12 +171,12 @@ */ | ||
## del | ||
`RSMQWorker.del( id )` | ||
Delete a messge from queue. This is usually done automatically unless you call `next(false)` | ||
@param { String } id The rsmq message id | ||
@param { String } id The rsmq message id | ||
@param { Function } [cb] A optional callback to get a secure response for a successful delete. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
@@ -207,11 +211,11 @@ */ | ||
## changeInterval | ||
`RSMQWorker.changeInterval( interval )` | ||
Change the interval timeouts in operation | ||
@param { Number|Array } interval The new interval | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@return { RSMQWorker } The instance itself for chaining. | ||
@api public | ||
@@ -228,7 +232,7 @@ */ | ||
## _initRSMQ | ||
`RSMQWorker._initRSMQ()` | ||
Initialize rsmq and handle disconnects | ||
@api private | ||
@@ -273,11 +277,11 @@ */ | ||
## _getRsmq | ||
`RSMQWorker._getRsmq( [forceInit] )` | ||
get or init the rsmq instance | ||
@param { Boolean } [forceInit=false] init rsmq even if it has been allready inited | ||
@return { RedisSMQ } A rsmq instance | ||
@return { RedisSMQ } A rsmq instance | ||
@api private | ||
@@ -316,7 +320,7 @@ */ | ||
## _initQueue | ||
`RSMQWorker._initQueue()` | ||
check if the given queue exists | ||
@api private | ||
@@ -354,11 +358,11 @@ */ | ||
## _send | ||
`RSMQWorker._send( msg, delay )` | ||
Internal send method that directly calls `rsmq.sendMessage()` . | ||
@param { String } msg The message content | ||
@param { String } msg The message content | ||
@param { Number } delay The message delay to hide this message for the next `x` seconds. | ||
@param { Function } [cb] A optional callback function | ||
@api private | ||
@@ -392,7 +396,7 @@ */ | ||
## _runOfflineMessages | ||
`RSMQWorker._runOfflineMessages()` | ||
Runn all messages collected by `.send()` while redis has been offline | ||
Runn all messages collected by `.send()` while redis has been offline | ||
@api private | ||
@@ -423,9 +427,9 @@ */ | ||
## receive | ||
`RSMQWorker.receive( _useInterval )` | ||
Receive a message | ||
@param { Boolean } _us Fire a `next` event to call e new receive on the call of `next()` | ||
@param { Boolean } _us Fire a `next` event to call e new receive on the call of `next()` | ||
@api private | ||
@@ -504,9 +508,9 @@ */ | ||
## check | ||
`RSMQWorker.check( msg )` | ||
Check if a message has been received to often and has to be deleted | ||
@param { Object } msg The raw rsmq message | ||
@param { Object } msg The raw rsmq message | ||
@api private | ||
@@ -530,7 +534,7 @@ */ | ||
## interval | ||
`RSMQWorker.interval()` | ||
call receive the intervall | ||
@api private | ||
@@ -541,3 +545,5 @@ */ | ||
this.debug("run interval"); | ||
this.receive(true); | ||
if (!this.stopped) { | ||
this.receive(true); | ||
} | ||
}; | ||
@@ -548,9 +554,9 @@ | ||
## next | ||
`RSMQWorker.next( [wait] )` | ||
Call the next recieve or wait until the next recieve has to be called | ||
@param { Boolean } [wait=false] Tell the next call that the last receive was empty to increase the wait time | ||
@param { Boolean } [wait=false] Tell the next call that the last receive was empty to increase the wait time | ||
@api private | ||
@@ -557,0 +563,0 @@ */ |
{ | ||
"name": "rsmq-worker", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "RSMQ helper to simply implement a worker around the message queue", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -290,2 +290,3 @@ ![RSMQ-Worker](https://trello-attachments.s3.amazonaws.com/5481963992d9ba3848568a1b/600x194/61b3b6117eeb0881c919c6996adb2620/rsmq_worker_small.png) | ||
|:--:|:--:|:--| | ||
|0.3.8|2015-11-04|Fixed stop behaviour. [Pull#5](https://github.com/mpneuried/rsmq-worker/pull/5). Thanks to [Exinferis](https://github.com/exinferis)| | ||
|0.3.7|2015-09-02|Added tests to check the behavior during errors within message processing; Added option `alwaysLogErrors` to prevent console logs if an error event handler was attached. [Issue #3](https://github.com/mpneuried/rsmq-worker/issues/3)| | ||
@@ -292,0 +293,0 @@ |0.3.6|2015-09-02|Updated dependencies; optimized readme (thanks to [Tobias Lidskog](https://github.com/tobli) for the [pull #4](https://github.com/mpneuried/rsmq-worker/pull/4))| |
35470
623
336