lib/amqpjs.js
function autoSubscribe() {
    //re-add pending subscribers
    if (_pendingSubscribers.length > 0) {
      async.each(_pendingSubscribers, function(sub, callback) {
        debug('Add pending subscriber', sub);
        self.subscribeToTopic(sub.exchange, sub.queue, sub.filter, sub.subscriber, sub.opts, function(err) {
          if (err) {
            debug('Failed to add subscriber, keep it', sub);
          } else {
            //done, remove the item from the pending subscribers
            var idx = _pendingSubscribers.indexOf(sub);
            _pendingSubscribers.splice(idx, 1);
            debug('pending subsriber added, now there are ' + _pendingSubscribers.length + ' left');
          }
          return callback();
        });
      }, function() {
        debug('pending subscribers are added');
      });
    }
  }
function autoSubscribe() {
    //re-add pending subscribers
    if (_pendingSubscribers.length > 0) {
      async.each(_pendingSubscribers, function(sub, callback) {
        debug('Add pending subscriber', sub);
        self.subscribeToTopic(sub.exchange, sub.queue, sub.filter, sub.subscriber, sub.opts, function(err) {
          if (err) {
            debug('Failed to add subscriber, keep it', sub);
          } else {
            //done, remove the item from the pending subscribers
            var idx = _pendingSubscribers.indexOf(sub);
            _pendingSubscribers.splice(idx, 1);
            debug('pending subsriber added, now there are ' + _pendingSubscribers.length + ' left');
          }
          return callback();
        });
      }, function() {
        debug('pending subscribers are added');
      });
    }
  }
function autoSubscribe ( ) { //re-add pending subscribers if ( _pendingSubscribers . length > 0 ) { async . each ( _pendingSubscribers , function ( sub , callback ) { debug ( 'Add pending subscriber' , sub ) ; self . subscribeToTopic ( sub . exchange , sub . queue , sub . filter , sub . subscriber , sub . opts , function ( err ) { if ( err ) { debug ( 'Failed to add subscriber, keep it' , sub ) ; } else { //done, remove the item from the pending subscribers var idx = _pendingSubscribers . indexOf ( sub ) ; _pendingSubscribers . splice ( idx , 1 ) ; debug ( 'pending subsriber added, now there are ' + _pendingSubscribers . length + ' left' ) ; } return callback ( ) ; } ) ; } , function ( ) { debug ( 'pending subscribers are added' ) ; } ) ; } }
Re-add subscriber functions that are created when there is no connection
Re - add subscriber functions that are created when there is no connection