rascal 15.0.1 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +25 -0
- package/lib/amqp/Publication.js +1 -0
- package/lib/amqp/Vhost.js +3 -3
- package/lib/amqp/tasks/applyBindings.js +5 -3
- package/lib/amqp/tasks/assertExchanges.js +10 -4
- package/lib/amqp/tasks/assertQueues.js +5 -3
- package/lib/amqp/tasks/checkExchanges.js +5 -3
- package/lib/amqp/tasks/checkQueues.js +5 -3
- package/lib/amqp/tasks/closeChannels.js +18 -0
- package/lib/amqp/tasks/createChannels.js +19 -0
- package/lib/amqp/tasks/deleteExchanges.js +5 -3
- package/lib/amqp/tasks/deleteQueues.js +5 -3
- package/lib/amqp/tasks/index.js +2 -2
- package/lib/amqp/tasks/purgeQueues.js +5 -3
- package/lib/config/baseline.js +1 -0
- package/lib/config/configure.js +9 -5
- package/lib/config/schema.json +4 -0
- package/lib/config/validate.js +2 -2
- package/package.json +3 -3
- package/lib/amqp/tasks/closeChannel.js +0 -12
- package/lib/amqp/tasks/createChannel.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 16.1.0
|
|
4
|
+
|
|
5
|
+
- Added concurrency option for managing RabbitMQ topology. Rascal will create and use upto this number of channels when asserting/checking/deleting/purging queues, exchanges and bindings.
|
|
6
|
+
|
|
7
|
+
## 16.0.0
|
|
8
|
+
|
|
9
|
+
- Automatically set replyTo message property when a publication references a replyTo queue
|
|
10
|
+
- Stop prefixing binding keys with replyTo uuid
|
|
11
|
+
- Drop support for Node 12
|
|
12
|
+
|
|
3
13
|
## 15.0.1
|
|
4
14
|
|
|
5
15
|
- Fix MaxListenersExceeded warning when there are more than 10 vhosts - See https://github.com/guidesmiths/rascal/issues/206
|
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ Rascal seeks to either solve these problems, make them easier to deal with or br
|
|
|
30
30
|
- Transparent encryption / decryption
|
|
31
31
|
- Automatic reconnection and resubscription
|
|
32
32
|
- Advanced error handling including delayed, limited retries
|
|
33
|
+
- RPC Support
|
|
33
34
|
- Redelivery protection
|
|
34
35
|
- Channel pooling
|
|
35
36
|
- Flow control
|
|
@@ -679,6 +680,26 @@ Enable to purge the queue during initialisation. Useful when running automated t
|
|
|
679
680
|
}
|
|
680
681
|
```
|
|
681
682
|
|
|
683
|
+
##### replyTo
|
|
684
|
+
|
|
685
|
+
Sometimes you want to publish a message, and have the consumer of the message send a reply to the same application instance that published the original message. This can be difficult if you application is deployed using multiple instances which share a common configuration. Quite often the solution is to make your application stateless so it doesn't matter which instance receives the reply. An altnernative is to mark the queue as a reply queue using the replyTo.
|
|
686
|
+
|
|
687
|
+
```json
|
|
688
|
+
{
|
|
689
|
+
"queues": {
|
|
690
|
+
"q1": {
|
|
691
|
+
"replyTo": true
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
"publications": {
|
|
695
|
+
"exchange": "e1",
|
|
696
|
+
"replyTo": "q1"
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
When true, Rascal will append a uuid to the queue name so that it is unique for each instance of the application. Use this conjunction with the publication replyTo property, to automaticlaly set the replyTo property on outbound messages to the unique queue name. You may also want to make make the queue non durable and exclusive too (see below).
|
|
702
|
+
|
|
682
703
|
##### options
|
|
683
704
|
|
|
684
705
|
Define any further configuration in an options block
|
|
@@ -1691,6 +1712,10 @@ is equivalent to...
|
|
|
1691
1712
|
}
|
|
1692
1713
|
```
|
|
1693
1714
|
|
|
1715
|
+
### Concurrency
|
|
1716
|
+
|
|
1717
|
+
If you have a high number of exchanges, queues and bindings you may wish to initialise Rascal using multiple channels to improve startup time. Do this per vhost by setting the `concurrency` option to the number of channels you want to create and use.
|
|
1718
|
+
|
|
1694
1719
|
### Connect
|
|
1695
1720
|
|
|
1696
1721
|
Rascal is a rich pub/sub wrapper and as such hides much of the amqplib [channel api](https://www.squaremobius.net/amqp.node/channel_api.html#channel). If you need to access this you can programmatically establish a connection to a vhost as follows.
|
package/lib/amqp/Publication.js
CHANGED
|
@@ -37,6 +37,7 @@ function Publication(vhost, borrowChannelFn, returnChannelFn, destroyChannelFn,
|
|
|
37
37
|
const content = getContent(payload);
|
|
38
38
|
publishConfig.options.contentType = publishConfig.options.contentType || content.type;
|
|
39
39
|
publishConfig.options.messageId = publishConfig.options.messageId || uuid();
|
|
40
|
+
publishConfig.options.replyTo = publishConfig.options.replyTo || publishConfig.replyTo;
|
|
40
41
|
|
|
41
42
|
publishConfig.encryption ? _publishEncrypted(content.buffer, publishConfig, next) : _publish(content.buffer, publishConfig, next);
|
|
42
43
|
};
|
package/lib/amqp/Vhost.js
CHANGED
|
@@ -26,10 +26,10 @@ function Vhost(vhostConfig, components) {
|
|
|
26
26
|
let confirmChannelPool;
|
|
27
27
|
const channelCreator = async.queue(createChannel, 1);
|
|
28
28
|
|
|
29
|
-
const init = async.compose(tasks.
|
|
29
|
+
const init = async.compose(tasks.closeChannels, tasks.applyBindings, tasks.purgeQueues, tasks.checkQueues, tasks.assertQueues, tasks.checkExchanges, tasks.assertExchanges, tasks.createChannels, tasks.createConnection, tasks.checkVhost, tasks.assertVhost);
|
|
30
30
|
const connect = async.compose(tasks.createConnection);
|
|
31
|
-
const purge = async.compose(tasks.closeConnection, tasks.
|
|
32
|
-
const nuke = async.compose(tasks.closeConnection, tasks.
|
|
31
|
+
const purge = async.compose(tasks.closeConnection, tasks.closeChannels, tasks.purgeQueues, tasks.createChannels, tasks.createConnection);
|
|
32
|
+
const nuke = async.compose(tasks.closeConnection, tasks.closeChannels, tasks.deleteQueues, tasks.deleteExchanges, tasks.createChannels, tasks.createConnection);
|
|
33
33
|
let timer = backoff({});
|
|
34
34
|
let paused = true;
|
|
35
35
|
let shuttingDown = false;
|
|
@@ -9,10 +9,12 @@ module.exports = _.curry((config, ctx, next) => {
|
|
|
9
9
|
exchange: bindExchange,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
async.
|
|
12
|
+
async.eachOfLimit(
|
|
13
13
|
_.values(config.bindings),
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
config.concurrency,
|
|
15
|
+
(binding, index, cb) => {
|
|
16
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
17
|
+
bind[binding.destinationType](config, channel, binding, cb);
|
|
16
18
|
},
|
|
17
19
|
(err) => {
|
|
18
20
|
next(err, config, ctx);
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.exchanges),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
assertExchange(channel, config.exchanges[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
|
@@ -18,5 +20,9 @@ function assertExchange(channel, config, next) {
|
|
|
18
20
|
if (!config.assert) return next();
|
|
19
21
|
if (config.fullyQualifiedName === '') return next();
|
|
20
22
|
debug('Asserting exchange: %s', config.fullyQualifiedName);
|
|
21
|
-
channel.assertExchange(config.fullyQualifiedName, config.type, config.options,
|
|
23
|
+
channel.assertExchange(config.fullyQualifiedName, config.type, config.options, (err) => {
|
|
24
|
+
if (err) return next(err);
|
|
25
|
+
debug('Asserted exchange: %s', config.fullyQualifiedName);
|
|
26
|
+
next();
|
|
27
|
+
});
|
|
22
28
|
}
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.queues),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
assertQueue(channel, config.queues[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.exchanges),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
checkExchange(channel, config.exchanges[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.queues),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
checkQueue(channel, config.queues[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const debug = require('debug')('rascal:tasks:closeChannels');
|
|
2
|
+
const async = require('async');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
+
debug('Closing %d channels', ctx.channels.length);
|
|
7
|
+
|
|
8
|
+
async.each(
|
|
9
|
+
ctx.channels,
|
|
10
|
+
(channel, cb) => {
|
|
11
|
+
channel.close(cb);
|
|
12
|
+
},
|
|
13
|
+
(err) => {
|
|
14
|
+
delete ctx.channels;
|
|
15
|
+
return next(err, config, ctx);
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const debug = require('debug')('rascal:tasks:createChannel');
|
|
2
|
+
const async = require('async');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
+
debug('Creating %d channels', config.concurrency);
|
|
7
|
+
|
|
8
|
+
async.times(
|
|
9
|
+
config.concurrency,
|
|
10
|
+
(index, cb) => {
|
|
11
|
+
ctx.connection.createChannel(cb);
|
|
12
|
+
},
|
|
13
|
+
(err, channels) => {
|
|
14
|
+
if (err) return next(err, config, ctx);
|
|
15
|
+
ctx.channels = channels;
|
|
16
|
+
next(null, config, ctx);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
});
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.exchanges),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
deleteExchange(channel, config.exchanges[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.queues),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
deleteQueue(channel, config.queues[name], cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
package/lib/amqp/tasks/index.js
CHANGED
|
@@ -6,9 +6,9 @@ exports.bounceVhost = require('./bounceVhost');
|
|
|
6
6
|
exports.checkExchanges = require('./checkExchanges');
|
|
7
7
|
exports.checkQueues = require('./checkQueues');
|
|
8
8
|
exports.checkVhost = require('./checkVhost');
|
|
9
|
-
exports.
|
|
9
|
+
exports.closeChannels = require('./closeChannels');
|
|
10
10
|
exports.closeConnection = require('./closeConnection');
|
|
11
|
-
exports.
|
|
11
|
+
exports.createChannels = require('./createChannels');
|
|
12
12
|
exports.createConnection = require('./createConnection');
|
|
13
13
|
exports.deleteExchanges = require('./deleteExchanges');
|
|
14
14
|
exports.deleteQueues = require('./deleteQueues');
|
|
@@ -3,10 +3,12 @@ const _ = require('lodash');
|
|
|
3
3
|
const async = require('async');
|
|
4
4
|
|
|
5
5
|
module.exports = _.curry((config, ctx, next) => {
|
|
6
|
-
async.
|
|
6
|
+
async.eachOfLimit(
|
|
7
7
|
_.keys(config.queues),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
config.concurrency,
|
|
9
|
+
(name, index, cb) => {
|
|
10
|
+
const channel = ctx.channels[index % config.concurrency];
|
|
11
|
+
purgeQueue(channel, config.queues[name], ctx, cb);
|
|
10
12
|
},
|
|
11
13
|
(err) => {
|
|
12
14
|
next(err, config, ctx);
|
package/lib/config/baseline.js
CHANGED
package/lib/config/configure.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = _.curry((rascalConfig, next) => {
|
|
|
43
43
|
{
|
|
44
44
|
name,
|
|
45
45
|
namespace: rascalConfig.defaults.vhosts.namespace,
|
|
46
|
+
concurrency: rascalConfig.defaults.vhosts.concurrency,
|
|
46
47
|
connectionStrategy: rascalConfig.defaults.vhosts.connectionStrategy,
|
|
47
48
|
publicationChannelPools: rascalConfig.defaults.vhosts.publicationChannelPools,
|
|
48
49
|
},
|
|
@@ -133,11 +134,11 @@ module.exports = _.curry((rascalConfig, next) => {
|
|
|
133
134
|
},
|
|
134
135
|
{}
|
|
135
136
|
);
|
|
136
|
-
|
|
137
137
|
_.each(_.defaults({}, publications, defaultPublications), configurePublication);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
function configurePublication(publicationConfig, name) {
|
|
141
|
+
if (publicationConfig.destination) return;
|
|
141
142
|
debug('Configuring publication: %s', name);
|
|
142
143
|
if (rascalConfig.publications[name] && rascalConfig.publications[name].vhost !== publicationConfig.vhost) throw new Error(format('Duplicate publication: %s', name));
|
|
143
144
|
rascalConfig.publications[name] = _.defaultsDeep(publicationConfig, { name }, rascalConfig.defaults.publications);
|
|
@@ -145,6 +146,13 @@ module.exports = _.curry((rascalConfig, next) => {
|
|
|
145
146
|
const destination = Object.prototype.hasOwnProperty.call(publicationConfig, 'exchange') ? rascalConfig.vhosts[publicationConfig.vhost].exchanges[publicationConfig.exchange] : rascalConfig.vhosts[publicationConfig.vhost].queues[publicationConfig.queue];
|
|
146
147
|
rascalConfig.publications[name].destination = destination.fullyQualifiedName;
|
|
147
148
|
|
|
149
|
+
if (publicationConfig.replyTo) {
|
|
150
|
+
const replyToQueue = rascalConfig.vhosts[publicationConfig.vhost].queues[publicationConfig.replyTo];
|
|
151
|
+
|
|
152
|
+
if (!replyToQueue) throw new Error(`Publication: ${name} refers to an unknown reply queue: ${publicationConfig.replyTo}`);
|
|
153
|
+
publicationConfig.replyTo = replyToQueue.fullyQualifiedName;
|
|
154
|
+
}
|
|
155
|
+
|
|
148
156
|
if (publicationConfig.encryption && _.isString(publicationConfig.encryption)) {
|
|
149
157
|
rascalConfig.publications[name].encryption = _.defaultsDeep({ name: publicationConfig.encryption }, rascalConfig.encryption[publicationConfig.encryption]);
|
|
150
158
|
}
|
|
@@ -260,10 +268,6 @@ module.exports = _.curry((rascalConfig, next) => {
|
|
|
260
268
|
if (bindingConfig.qualifyBindingKeys) {
|
|
261
269
|
config.bindings[name].bindingKey = fqn.qualify(bindingConfig.bindingKey, config.namespace);
|
|
262
270
|
}
|
|
263
|
-
if (bindingConfig.destinationType === 'queue') {
|
|
264
|
-
const queue = config.queues[bindingConfig.destination];
|
|
265
|
-
config.bindings[name].bindingKey = fqn.prefix(queue && queue.replyTo, bindingConfig.bindingKey, '.');
|
|
266
|
-
}
|
|
267
271
|
});
|
|
268
272
|
}
|
|
269
273
|
|
package/lib/config/schema.json
CHANGED
package/lib/config/validate.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = _.curry((config, next) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function validateVhost(vhost, vhostName) {
|
|
23
|
-
validateAttributes('Vhost', vhost, vhostName, ['defaults', 'namespace', 'name', 'publicationChannelPools', 'connection', 'connections', 'connectionStrategy', 'exchanges', 'queues', 'bindings', 'check', 'assert']);
|
|
23
|
+
validateAttributes('Vhost', vhost, vhostName, ['defaults', 'namespace', 'name', 'concurrency', 'publicationChannelPools', 'connection', 'connections', 'connectionStrategy', 'exchanges', 'queues', 'bindings', 'check', 'assert']);
|
|
24
24
|
validateConnectionStrategy(vhost.connectionStrategy, vhostName);
|
|
25
25
|
validateConnectionAttributes(vhost.connection, vhostName, ['slashes', 'protocol', 'hostname', 'user', 'password', 'port', 'vhost', 'options', 'retry', 'auth', 'pathname', 'query', 'url', 'loggableUrl', 'management']);
|
|
26
26
|
validateManagementConnectionAttributes(_.get(vhost), 'connection.management', vhostName, ['slashes', 'protocol', 'hostname', 'user', 'password', 'port', 'vhost', 'options', 'auth', 'pathname', 'query', 'url', 'loggableUrl']);
|
|
@@ -101,7 +101,7 @@ module.exports = _.curry((config, next) => {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function validatePublication(publication, publicationName) {
|
|
104
|
-
validateAttributes('Publication', publication, publicationName, ['name', 'vhost', 'exchange', 'queue', 'routingKey', 'confirm', 'options', 'destination', 'autoCreated', 'deprecated', 'encryption', 'timeout']);
|
|
104
|
+
validateAttributes('Publication', publication, publicationName, ['name', 'vhost', 'exchange', 'queue', 'routingKey', 'confirm', 'options', 'destination', 'autoCreated', 'deprecated', 'encryption', 'replyTo', 'timeout']);
|
|
105
105
|
if (!publication.vhost) throw new Error(format('Publication: %s is missing a vhost', publicationName));
|
|
106
106
|
if (!(Object.prototype.hasOwnProperty.call(publication, 'exchange') || publication.queue)) throw new Error(format('Publication: %s is missing an exchange or a queue', publicationName));
|
|
107
107
|
if (Object.prototype.hasOwnProperty.call(publication, 'exchange') && publication.queue) throw new Error(format('Publication: %s has an exchange and a queue', publicationName));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rascal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "A config driven wrapper for amqplib supporting multi-host connections, automatic error recovery, redelivery flood protection, transparent encryption / decryption, channel pooling and publication timeouts",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"prettier": "^2.4.1",
|
|
31
31
|
"random-readable": "^1.0.1",
|
|
32
32
|
"superagent-defaults": "^0.1.14",
|
|
33
|
-
"zunit": "^
|
|
33
|
+
"zunit": "^4.0.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"amqplib": ">=0.5.5"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=14"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "zUnit",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const debug = require('debug')('rascal:tasks:closeChannel');
|
|
2
|
-
const _ = require('lodash');
|
|
3
|
-
|
|
4
|
-
module.exports = _.curry((config, ctx, next) => {
|
|
5
|
-
debug('Closing channel');
|
|
6
|
-
|
|
7
|
-
ctx.channel.close((err) => {
|
|
8
|
-
if (err) return next(err, config, ctx);
|
|
9
|
-
delete ctx.channel;
|
|
10
|
-
next(null, config, ctx);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const debug = require('debug')('rascal:tasks:createChannel');
|
|
2
|
-
const _ = require('lodash');
|
|
3
|
-
|
|
4
|
-
module.exports = _.curry((config, ctx, next) => {
|
|
5
|
-
debug('Creating channel');
|
|
6
|
-
|
|
7
|
-
ctx.connection.createChannel((err, channel) => {
|
|
8
|
-
if (err) return next(err, config, ctx);
|
|
9
|
-
ctx.channel = channel;
|
|
10
|
-
next(null, config, ctx);
|
|
11
|
-
});
|
|
12
|
-
});
|