Browse Source

fix: #1 - close kestrel client when stopping consumer

version bump to v0.0.2 and change to homepage url in package.json
pull/3/head v0.0.2
Brett Langdon 13 years ago
parent
commit
89804c0071
2 changed files with 13 additions and 6 deletions
  1. +10
    -3
      lib/kestrelConsumer.js
  2. +3
    -3
      package.json

+ 10
- 3
lib/kestrelConsumer.js View File

@ -6,6 +6,7 @@ var util = require('util');
var consumer = function( queue, options ){
this._queue = queue;
this._options = new client(options);
this._client = new client(options);
this._client.connect();
@ -15,11 +16,11 @@ var consumer = function( queue, options ){
var self = this;
this._client.on('message', function(message){
if( typeof self._callback == 'function' ){
self._callback(message);
}
if( self._consume ){
self.get(self._timeout);
}
@ -41,6 +42,10 @@ consumer.prototype.get = function( timeout ){
}
consumer.prototype.consume = function( callback ){
if(!this._client){
this._client = client(this._options);
this.client.connect();
}
if( typeof(callback) == 'function' ){
this._callback = callback;
}
@ -50,6 +55,8 @@ consumer.prototype.consume = function( callback ){
consumer.prototype.stopConsuming = function(){
this._consume = false;
this._client.close();
this._client = null;
}
module.exports = consumer;
module.exports = consumer;

+ 3
- 3
package.json View File

@ -1,10 +1,10 @@
{
"name": "node-kestrel"
, "version": "0.0.1"
, "version": "0.0.2"
, "description": "Kestrel client module for NodeJS"
, "homepage": "http://www.blangdon.com/"
, "homepage": "https://github.com/brettlangdon/node-kestrel"
, "keywords": ["kestrel", "client", "messaging", "queue"]
, "author": "brett_langdon <brett@blangdon.com>"
, "author": "brett_langdon <brett@blangdon.com> (http://brett.is)"
, "contributors": [
{ "name": "brett_langdon", "email": "brett@blangdon.com" }
]


Loading…
Cancel
Save