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
13 lines (10 loc) • 308 B
JavaScript
const debug = require('debug')('rascal:tasks:closeChannel');
const _ = require('lodash');
module.exports = _.curry((config, ctx, next) => {
debug('Closing channel');
ctx.channel.close((err) => {
if (err) return next(err, config, ctx);
delete ctx.channel;
next(null, config, ctx);
});
});