UNPKG

rascal

Version:

A config driven wrapper for amqplib supporting multi-host connections, automatic error recovery, redelivery flood protection, transparent encryption / decryption, channel pooling and publication timeouts

22 lines (19 loc) 619 B
const debug = require('debug')('rascal:tasks:deleteExchanges'); const _ = require('lodash'); const async = require('async'); module.exports = _.curry((config, ctx, next) => { async.eachSeries( _.keys(config.exchanges), (name, callback) => { deleteExchange(ctx.channel, config.exchanges[name], callback); }, (err) => { next(err, config, ctx); } ); }); function deleteExchange(channel, config, next) { if (config.fullyQualifiedName === '') return next(); debug('Deleting exchange: %s', config.fullyQualifiedName); channel.deleteExchange(config.fullyQualifiedName, {}, next); }