src/amqp/queue.js
function purgeADQueue (channel, connectionName, options, messages) {
  const name = options.uniqueName || options.name;
  return new Promise(function (resolve, reject) {
    const messageCount = messages.messages.length;
    if (messageCount > 0) {
      log.info(`Purge operation for queue '${options.name}' on '${connectionName}' is waiting for resolution on ${messageCount} messages`);
      messages.once('empty', function () {
        channel.purgeQueue(name)
          .then(
            result => resolve(result.messageCount),
            reject
          );
      });
    } else {
      channel.purgeQueue(name)
        .then(
          result => resolve(result.messageCount),
          reject
        );
    }
  });
}
function purgeADQueue (channel, connectionName, options, messages) {
  const name = options.uniqueName || options.name;
  return new Promise(function (resolve, reject) {
    const messageCount = messages.messages.length;
    if (messageCount > 0) {
      log.info(`Purge operation for queue '${options.name}' on '${connectionName}' is waiting for resolution on ${messageCount} messages`);
      messages.once('empty', function () {
        channel.purgeQueue(name)
          .then(
            result => resolve(result.messageCount),
            reject
          );
      });
    } else {
      channel.purgeQueue(name)
        .then(
          result => resolve(result.messageCount),
          reject
        );
    }
  });
}
function purgeADQueue ( channel , connectionName , options , messages ) { const name = options . uniqueName || options . name ; return new Promise ( function ( resolve , reject ) { const messageCount = messages . messages . length ; if ( messageCount > 0 ) { log . info ( ` ${ options . name } ${ connectionName } ${ messageCount } ` ) ; messages . once ( 'empty' , function ( ) { channel . purgeQueue ( name ) . then ( result => resolve ( result . messageCount ) , reject ) ; } ) ; } else { channel . purgeQueue ( name ) . then ( result => resolve ( result . messageCount ) , reject ) ; } } ) ; }
purging an auto-delete queue means unsubscribing is not an option as it will cause the queue, binding and possibly upstream auto-delete exchanges to be deleted as well
purging an auto - delete queue means unsubscribing is not an option as it will cause the queue binding and possibly upstream auto - delete exchanges to be deleted as well