Skip to content

Commit ec6ecfe

Browse files
committed
Added pass through for amqplib 'blocked' and 'unblocked' events to allow registration of handlers.
1 parent 8a34b30 commit ec6ecfe

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/sockets.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ function Context(url) {
3737
EventEmitter.call(this);
3838
var self = this;
3939
var onError = errorLater(this);
40-
var onClose = this.emit.bind(this, 'close');
4140
var c = this._connection = amqp.connect(url);
4241
c.then(function(conn) {
4342
conn.on('error', onError);
44-
conn.on('close', onClose);
43+
['close', 'blocked', 'unblocked'].forEach(function(ev) {
44+
conn.on(ev, self.emit.bind(self, ev));
45+
});
4546
});
4647
c.then(this.emit.bind(this, 'ready')).then(null, onError);
4748
};

0 commit comments

Comments
 (0)