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) 593 B
const debug = require('debug')('rascal:tasks:assertQueues'); const _ = require('lodash'); const async = require('async'); module.exports = _.curry((config, ctx, next) => { async.eachSeries( _.keys(config.queues), (name, callback) => { assertQueue(ctx.channel, config.queues[name], callback); }, (err) => { next(err, config, ctx); } ); }); function assertQueue(channel, config, next) { if (!config.assert) return next(); debug('Asserting queue: %s', config.fullyQualifiedName); channel.assertQueue(config.fullyQualifiedName, config.options, next); }