lib/amqpjs.js
function publishCachedMessages() {
    if (_cachedPublishMessages.length > 0) {
      async.each(_cachedPublishMessages, function(message, callback) {
        debug('republish message', message);
        self.publishTopic(message.exchange, message.topic, message.message, message.options, function(err) {
          if (err) {
            debug('Failed to republish message', message);
          } else {
            var idx = _cachedPublishMessages.indexOf(message);
            _cachedPublishMessages.splice(idx, 1);
            debug('cached publish message re-published, now there are ' + _cachedPublishMessages.length + ' messages left');
          }
          return callback();
        });
      }, function() {
        debug('cached publish messages processed');
      });
    }
  }
function publishCachedMessages() {
    if (_cachedPublishMessages.length > 0) {
      async.each(_cachedPublishMessages, function(message, callback) {
        debug('republish message', message);
        self.publishTopic(message.exchange, message.topic, message.message, message.options, function(err) {
          if (err) {
            debug('Failed to republish message', message);
          } else {
            var idx = _cachedPublishMessages.indexOf(message);
            _cachedPublishMessages.splice(idx, 1);
            debug('cached publish message re-published, now there are ' + _cachedPublishMessages.length + ' messages left');
          }
          return callback();
        });
      }, function() {
        debug('cached publish messages processed');
      });
    }
  }
function publishCachedMessages ( ) { if ( _cachedPublishMessages . length > 0 ) { async . each ( _cachedPublishMessages , function ( message , callback ) { debug ( 'republish message' , message ) ; self . publishTopic ( message . exchange , message . topic , message . message , message . options , function ( err ) { if ( err ) { debug ( 'Failed to republish message' , message ) ; } else { var idx = _cachedPublishMessages . indexOf ( message ) ; _cachedPublishMessages . splice ( idx , 1 ) ; debug ( 'cached publish message re-published, now there are ' + _cachedPublishMessages . length + ' messages left' ) ; } return callback ( ) ; } ) ; } , function ( ) { debug ( 'cached publish messages processed' ) ; } ) ; } }
Re-publish messages that received when there is no connection
Re - publish messages that received when there is no connection