rascal 17.0.1 → 18.0.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 CHANGED
@@ -1,16 +1,28 @@
1
1
  # Change Log
2
2
 
3
+ ## 18.0.0
4
+
5
+ - Fixes https://github.com/onebeyond/rascal/issues/227 by requiring special characters to be URL encoded.
6
+ - Consolidated broker and management url configuration logic
7
+
8
+ ## 17.0.2
9
+
10
+ - Update guidesmiths references to onebeyond.
11
+ - Dedupe channel poole ready check
12
+ - Remove unnecessary subscription config from busy publisher example
13
+ - Fixed bug where hostname connection order was not properly randomised
14
+
3
15
  ## 17.0.1
4
16
 
5
17
  - Rework the republish and forward recovery strategies to remove remote chance of repeat ack/nack
6
18
 
7
19
  ## 17.0.0
8
20
 
9
- - Updated the configuration processing as per https://github.com/guidesmiths/rascal/issues/219
21
+ - Updated the configuration processing as per https://github.com/onebeyond/rascal/issues/219
10
22
  - Test on Node 20
11
23
  - Abandon dependabot (too noisy)
12
24
  - Bump deps
13
- - Add support for channel level prefetch as per https://github.com/guidesmiths/rascal/issues/221
25
+ - Add support for channel level prefetch as per https://github.com/onebeyond/rascal/issues/221
14
26
  - Dropped prettier (it does nothing of the sort!)
15
27
 
16
28
  ## 16.3.0
@@ -45,7 +57,7 @@
45
57
 
46
58
  ## 15.0.1
47
59
 
48
- - Fix MaxListenersExceeded warning when there are more than 10 vhosts - See https://github.com/guidesmiths/rascal/issues/206
60
+ - Fix MaxListenersExceeded warning when there are more than 10 vhosts - See https://github.com/onebeyond/rascal/issues/206
49
61
 
50
62
  ## 15.0.0
51
63
 
@@ -54,11 +66,11 @@
54
66
 
55
67
  ## 14.4.5
56
68
 
57
- - Fixed issue where a partial password could be logged in debug - See https://github.com/guidesmiths/rascal/issues/200 - thanks @matt1097
69
+ - Fixed issue where a partial password could be logged in debug - See https://github.com/onebeyond/rascal/issues/200 - thanks @matt1097
58
70
 
59
71
  ## 14.4.4
60
72
 
61
- - Fixed issue where channels were not returned to the pool after publishing a large messag - See https://github.com/guidesmiths/rascal/issues/199
73
+ - Fixed issue where channels were not returned to the pool after publishing a large messag - See https://github.com/onebeyond/rascal/issues/199
62
74
 
63
75
  ## 14.4.3
64
76
 
@@ -81,15 +93,15 @@
81
93
  ## 14.4.1
82
94
 
83
95
  - Bump dependencies / fix audit warnings
84
- - Fix busy publisher example to consistenly use regular channels - See https://github.com/guidesmiths/rascal/issues/194
96
+ - Fix busy publisher example to consistenly use regular channels - See https://github.com/onebeyond/rascal/issues/194
85
97
 
86
98
  ## 14.4.0
87
99
 
88
- - Report validation error when no vhosts are specified - See https://github.com/guidesmiths/rascal/issues/181
100
+ - Report validation error when no vhosts are specified - See https://github.com/onebeyond/rascal/issues/181
89
101
 
90
102
  ## 14.3.0
91
103
 
92
- - Clone config instead of freezing it so buffers will work - See https://github.com/guidesmiths/rascal/issues/92
104
+ - Clone config instead of freezing it so buffers will work - See https://github.com/onebeyond/rascal/issues/92
93
105
 
94
106
  ## 14.2.1
95
107
 
@@ -97,15 +109,15 @@
97
109
 
98
110
  ## 14.2.0
99
111
 
100
- - Add json schema (lib/config/schema.json) - See https://github.com/guidesmiths/rascal/issues/168
112
+ - Add json schema (lib/config/schema.json) - See https://github.com/onebeyond/rascal/issues/168
101
113
 
102
114
  ## 14.1.0
103
115
 
104
- - Adds support for custom user agents - See https://github.com/guidesmiths/rascal/issues/170
116
+ - Adds support for custom user agents - See https://github.com/onebeyond/rascal/issues/170
105
117
 
106
118
  ## 14.0.1
107
119
 
108
- - Fixes https://github.com/guidesmiths/rascal/issues/178
120
+ - Fixes https://github.com/onebeyond/rascal/issues/178
109
121
 
110
122
  ## 14.0.0
111
123
 
@@ -126,15 +138,15 @@
126
138
 
127
139
  ## 13.1.2
128
140
 
129
- - Fixed various issues when queue names contained period characters. Reported in https://github.com/guidesmiths/rascal/issues/166
141
+ - Fixed various issues when queue names contained period characters. Reported in https://github.com/onebeyond/rascal/issues/166
130
142
 
131
143
  ## 13.1.1
132
144
 
133
- - Moved setMaxListeners to createConnection task to suppress misleading 'Possible EventEmitter memory leak detected' warning. See https://github.com/guidesmiths/rascal/issues/164 for more details.
145
+ - Moved setMaxListeners to createConnection task to suppress misleading 'Possible EventEmitter memory leak detected' warning. See https://github.com/onebeyond/rascal/issues/164 for more details.
134
146
 
135
147
  ## 13.1.0
136
148
 
137
- - Fixed bug where Rascal could wait indefinitely for channels to be destroyed if shutdown was called following a heartbeat timeout. See https://github.com/guidesmiths/rascal/issues/158 for more details.
149
+ - Fixed bug where Rascal could wait indefinitely for channels to be destroyed if shutdown was called following a heartbeat timeout. See https://github.com/onebeyond/rascal/issues/158 for more details.
138
150
 
139
151
  ## 13.0.6
140
152
 
@@ -147,7 +159,7 @@
147
159
 
148
160
  ## 13.0.4
149
161
 
150
- - Fixed https://github.com/guidesmiths/rascal/issues/156
162
+ - Fixed https://github.com/onebeyond/rascal/issues/156
151
163
 
152
164
  ## 13.0.3
153
165
 
@@ -155,7 +167,7 @@
155
167
 
156
168
  ## 13.0.2
157
169
 
158
- - Fixed https://github.com/guidesmiths/rascal/issues/150
170
+ - Fixed https://github.com/onebeyond/rascal/issues/150
159
171
 
160
172
  ## 13.0.1
161
173
 
@@ -175,7 +187,7 @@
175
187
 
176
188
  ## 12.0.3
177
189
 
178
- - Fix https://github.com/guidesmiths/rascal/issues/141
190
+ - Fix https://github.com/onebeyond/rascal/issues/141
179
191
  - Fix error message typos
180
192
  - Bump lodash
181
193
 
@@ -186,7 +198,7 @@
186
198
  ## 12.0.1
187
199
 
188
200
  - Moved from travis to github actions
189
- - Fix broker waiting indefinitely when shutdown is called after losing a connection. See [#126](https://github.com/guidesmiths/rascal/issues/126)
201
+ - Fix broker waiting indefinitely when shutdown is called after losing a connection. See [#126](https://github.com/onebeyond/rascal/issues/126)
190
202
 
191
203
  ## 12.0.0
192
204
 
@@ -214,29 +226,29 @@
214
226
 
215
227
  ### Updated
216
228
 
217
- - Improved readme as per issue [#111](https://github.com/guidesmiths/rascal/issues/111)
229
+ - Improved readme as per issue [#111](https://github.com/onebeyond/rascal/issues/111)
218
230
 
219
231
  ### Fixed
220
232
 
221
- - Fixed issue [#123](https://github.com/guidesmiths/rascal/issues/123), where a race condition was causing channels to be closed twice. Thanks @cinnq346.
233
+ - Fixed issue [#123](https://github.com/onebeyond/rascal/issues/123), where a race condition was causing channels to be closed twice. Thanks @cinnq346.
222
234
 
223
235
  ## 10.2.4
224
236
 
225
237
  ### Fixed
226
238
 
227
- - Fixed issue [#122](https://github.com/guidesmiths/rascal/issues/122), where error listeners were registered once, so repeated errors could bubble up and crash node
239
+ - Fixed issue [#122](https://github.com/onebeyond/rascal/issues/122), where error listeners were registered once, so repeated errors could bubble up and crash node
228
240
 
229
241
  ## 10.2.3
230
242
 
231
243
  ### Fixed
232
244
 
233
- - Fixed second part of issue [#121](https://github.com/guidesmiths/rascal/issues/121), where the generic-pool could cause tight loops and memory leaks
245
+ - Fixed second part of issue [#121](https://github.com/onebeyond/rascal/issues/121), where the generic-pool could cause tight loops and memory leaks
234
246
 
235
247
  ## 10.2.2
236
248
 
237
249
  ### Fixed
238
250
 
239
- - Fixed issue [#121](https://github.com/guidesmiths/rascal/issues/121), which caused rascals connection index to permanently increment rather than cycling back to 0. Consequently if all nodes in a cluster failed, Rascal could crash the application.
251
+ - Fixed issue [#121](https://github.com/onebeyond/rascal/issues/121), which caused rascals connection index to permanently increment rather than cycling back to 0. Consequently if all nodes in a cluster failed, Rascal could crash the application.
240
252
 
241
253
  ## 10.2.1
242
254
 
@@ -265,7 +277,7 @@
265
277
 
266
278
  ### Updated
267
279
 
268
- - Set vhost max event listeners to inifinity (see https://github.com/guidesmiths/rascal/issues/99)
280
+ - Set vhost max event listeners to inifinity (see https://github.com/onebeyond/rascal/issues/99)
269
281
 
270
282
  ## 10.0.0
271
283
 
@@ -289,13 +301,13 @@
289
301
 
290
302
  ### Updated
291
303
 
292
- - [Fixed #78](https://github.com/guidesmiths/rascal/issues/78) by using a baseline config, and only laying connection options via withDefaultConfig
304
+ - [Fixed #78](https://github.com/onebeyond/rascal/issues/78) by using a baseline config, and only laying connection options via withDefaultConfig
293
305
 
294
306
  ## 9.2.0
295
307
 
296
308
  ### Added
297
309
 
298
- - [Fixed #93](https://github.com/guidesmiths/rascal/issues/93) through use of setInterval to keep node process active in the event of broker restart.
310
+ - [Fixed #93](https://github.com/onebeyond/rascal/issues/93) through use of setInterval to keep node process active in the event of broker restart.
299
311
 
300
312
  ### Updated
301
313
 
@@ -347,8 +359,8 @@
347
359
 
348
360
  ### Updated
349
361
 
350
- - Fixed [#86](https://github.com/guidesmiths/rascal/issues/85)
351
- - Fixed [#84](https://github.com/guidesmiths/rascal/issues/84). Thanks @huikaihoo
362
+ - Fixed [#86](https://github.com/onebeyond/rascal/issues/85)
363
+ - Fixed [#84](https://github.com/onebeyond/rascal/issues/84). Thanks @huikaihoo
352
364
 
353
365
  ### Added
354
366
 
@@ -358,14 +370,14 @@
358
370
 
359
371
  ### Updated
360
372
 
361
- - emit error when publishFn err Channel closed as oer https://github.com/guidesmiths/rascal/pull/81. Thanks @zijin-m
373
+ - emit error when publishFn err Channel closed as oer https://github.com/onebeyond/rascal/pull/81. Thanks @zijin-m
362
374
 
363
375
  ## 8.0.0
364
376
 
365
377
  ### Updated
366
378
 
367
379
  - Drop support for Node 6
368
- - Updated dependencies as per https://github.com/guidesmiths/rascal/pull/75. Thanks @ravihara
380
+ - Updated dependencies as per https://github.com/onebeyond/rascal/pull/75. Thanks @ravihara
369
381
 
370
382
  ## 7.0.0
371
383
 
@@ -378,7 +390,7 @@
378
390
 
379
391
  ### Fixed
380
392
 
381
- - Fixed [#72](https://github.com/guidesmiths/rascal/issues/72) which meant published messages waiting for a channel would be lost on connection error
393
+ - Fixed [#72](https://github.com/onebeyond/rascal/issues/72) which meant published messages waiting for a channel would be lost on connection error
382
394
 
383
395
  ## 6.0.2
384
396
 
@@ -392,7 +404,7 @@
392
404
 
393
405
  ## 6.0.0
394
406
 
395
- - Improved channel pool management (includes a breaking config change - see https://github.com/guidesmiths/rascal#channel-pooling).
407
+ - Improved channel pool management (includes a breaking config change - see https://github.com/onebeyond/rascal#channel-pooling).
396
408
 
397
409
  ## 5.1.0
398
410
 
@@ -585,7 +597,7 @@
585
597
  ### Updated
586
598
 
587
599
  - Using lodash defaultsDeep instead of merge-defaults (fixes hoek vulnerability). The behaviour seems consistent but releasing as a breaking change as a precaution.
588
- - Unqualified default publications and subscriptions are no longer supported. See https://github.com/guidesmiths/rascal/issues/20
600
+ - Unqualified default publications and subscriptions are no longer supported. See https://github.com/onebeyond/rascal/issues/20
589
601
  - Testing on node 10
590
602
 
591
603
  ## 2.12.2
@@ -726,7 +738,7 @@
726
738
 
727
739
  ### Fixed
728
740
 
729
- - confirmPoolSize option as per https://github.com/guidesmiths/rascal/pull/19
741
+ - confirmPoolSize option as per https://github.com/onebeyond/rascal/pull/19
730
742
 
731
743
  ## 1.4.0
732
744
 
@@ -755,7 +767,7 @@
755
767
 
756
768
  ### Added
757
769
 
758
- - Workaround for https://github.com/guidesmiths/rascal/issues/17
770
+ - Workaround for https://github.com/onebeyond/rascal/issues/17
759
771
 
760
772
  ## 1.1.0
761
773
 
package/README.md CHANGED
@@ -4,9 +4,9 @@ Rascal is a rich pub/sub wrapper around [amqplib](https://www.npmjs.com/package/
4
4
 
5
5
  [![NPM version](https://img.shields.io/npm/v/rascal.svg?style=flat-square)](https://www.npmjs.com/package/rascal)
6
6
  [![NPM downloads](https://img.shields.io/npm/dm/rascal.svg?style=flat-square)](https://www.npmjs.com/package/rascal)
7
- [![Node.js CI](https://github.com/guidesmiths/rascal/workflows/Node.js%20CI/badge.svg)](https://github.com/guidesmiths/rascal/actions?query=workflow%3A%22Node.js+CI%22)
8
- [![Code Climate](https://codeclimate.com/github/guidesmiths/rascal/badges/gpa.svg)](https://codeclimate.com/github/guidesmiths/rascal)
9
- [![Test Coverage](https://codeclimate.com/github/guidesmiths/rascal/badges/coverage.svg)](https://codeclimate.com/github/guidesmiths/rascal/coverage)
7
+ [![Node.js CI](https://github.com/onebeyond/rascal/workflows/Node.js%20CI/badge.svg)](https://github.com/onebeyond/rascal/actions?query=workflow%3A%22Node.js+CI%22)
8
+ [![Code Climate](https://codeclimate.com/github/onebeyond/rascal/badges/gpa.svg)](https://codeclimate.com/github/onebeyond/rascal)
9
+ [![Test Coverage](https://codeclimate.com/github/onebeyond/rascal/badges/coverage.svg)](https://codeclimate.com/github/onebeyond/rascal/coverage)
10
10
  [![rascal](https://snyk.io/advisor/npm-package/rascal/badge.svg)](https://snyk.io/advisor/npm-package/rascal)
11
11
  [![Discover zUnit](https://img.shields.io/badge/Discover-zUnit-brightgreen)](https://www.npmjs.com/package/zunit)
12
12
 
@@ -47,13 +47,13 @@ Rascal extends the existing [RabbitMQ Concepts](https://www.rabbitmq.com/tutoria
47
47
 
48
48
  A **publication** is a named configuration for publishing a message, including the destination queue or exchange, routing configuration, encryption profile and reliability guarantees, message options, etc. A **subscription** is a named configuration for consuming messages, including the source queue, encryption profile, content encoding, delivery options (e.g. acknowledgement handling and prefetch), etc. These must be [configured](#configuration) and supplied when creating the Rascal broker. After the broker has been created the subscriptions and publications can be retrieved from the broker and used to publish and consume messages.
49
49
 
50
- ### Breaking Changes in Rascal@14
50
+ ### Breaking Changes
51
51
 
52
- Rascal@14 waits for inflight messages to be acknowledged before closing subscriber channels. Prior to this version Rascal just waited an arbitrary amount of time. If your application does not acknowledge a message for some reason (quite likely in tests) calling `subscription.cancel`, `broker.unsubscribeAll`, `broker.bounce`, `broker.shutdown` or `broker.nuke` will wait indefinitely. You can specify a `closeTimeout` in your subscription config, however if this is exceeded the `subscription.cancel` and `broker.unsubscribeAll` methods will yield an error via callback or rejection, while the `broker.bounce`, `broker.shutdown` and `broker.nuke` methods will emit an error event, but attempt to continue. In both cases the error will have a code of `ETIMEDOUT`.
52
+ Please refer to the [Change Log](https://github.com/onebeyond/rascal/blob/master/CHANGELOG.md)
53
53
 
54
54
  ### Special Note
55
55
 
56
- RabbitMQ 3.8.0 introduced [quorum queues](https://www.rabbitmq.com/quorum-queues.html). Although quorum queues may not be suitable in all situations, they provide [poison message handling](https://www.rabbitmq.com/quorum-queues.html#poison-message-handling) without the need for an external [redelivery counter](https://github.com/guidesmiths/rascal#dealing-with-redeliveries) and offer better data safety in the event of a network partition. You can read more about them [here](https://www.cloudamqp.com/blog/reasons-you-should-switch-to-quorum-queues.html) and [here](https://blog.rabbitmq.com/posts/2020/06/quorum-queues-local-delivery).
56
+ RabbitMQ 3.8.0 introduced [quorum queues](https://www.rabbitmq.com/quorum-queues.html). Although quorum queues may not be suitable in all situations, they provide [poison message handling](https://www.rabbitmq.com/quorum-queues.html#poison-message-handling) without the need for an external [redelivery counter](https://github.com/onebeyond/rascal#dealing-with-redeliveries) and offer better data safety in the event of a network partition. You can read more about them [here](https://www.cloudamqp.com/blog/reasons-you-should-switch-to-quorum-queues.html) and [here](https://blog.rabbitmq.com/posts/2020/06/quorum-queues-local-delivery).
57
57
 
58
58
  ## Examples
59
59
 
@@ -116,7 +116,7 @@ Broker.create(config, (err, broker) => {
116
116
  });
117
117
  ```
118
118
 
119
- See [here](https://github.com/guidesmiths/rascal/tree/master/examples) for more examples.
119
+ See [here](https://github.com/onebeyond/rascal/tree/master/examples) for more examples.
120
120
 
121
121
  ## Avoiding Potential Message Loss
122
122
 
@@ -318,6 +318,7 @@ The simplest way to specify a connection is with a url
318
318
  }
319
319
  }
320
320
  ```
321
+ As of Rascal v18.0.0 you must URL encode special characters appearing in the username, password and vhost, e.g. `amqp://guest:secr%23t@broker.example.com:5672/v1?heartbeat=10`
321
322
 
322
323
  Alternatively you can specify the individual connection details
323
324
 
@@ -345,6 +346,8 @@ Alternatively you can specify the individual connection details
345
346
  }
346
347
  ```
347
348
 
349
+ Special characters do not need to be encoded when specified in this form.
350
+
348
351
  Any attributes you add to the "options" sub document will be converted to query parameters. Any attributes you add in the "socketOptions" sub document will be passed directly to amqplib's connect method (which hands them off to `net` or `tls`. Providing you merge your configuration with the default configuration `rascal.withDefaultConfig(config)` you need only specify the attributes you want to override
349
352
 
350
353
  ```json
@@ -459,7 +462,7 @@ The AMQP protocol doesn't support assertion or checking of vhosts, so Rascal use
459
462
  }
460
463
  ```
461
464
 
462
- Rascal uses [superagent](https://github.com/visionmedia/superagent) under the hood. URL configuration is supported.
465
+ Rascal uses [superagent](https://github.com/visionmedia/superagent) under the hood. URL configuration is also supported.
463
466
 
464
467
  ```json
465
468
  {
@@ -1401,7 +1404,7 @@ Rascal provides three counter implementations:
1401
1404
  2. inMemory - useful only for testing since if your node process crashes, the counter will be vaporised too
1402
1405
  3. inMemoryCluster - like the inMemory, but since the counter resides in the master it survives worker crashes.
1403
1406
 
1404
- Of the three only inMemoryCluster is useful in production, and then only if you are using [clustering](https://nodejs.org/api/cluster.html). See the [advanced example](https://github.com/guidesmiths/rascal/tree/master/examples/advanced) for how to configure it.
1407
+ Of the three only inMemoryCluster is useful in production, and then only if you are using [clustering](https://nodejs.org/api/cluster.html). See the [advanced example](https://github.com/onebeyond/rascal/tree/master/examples/advanced) for how to configure it.
1405
1408
 
1406
1409
  #### Implementing your own counter
1407
1410
 
@@ -28,11 +28,6 @@
28
28
  "persistent": false
29
29
  }
30
30
  }
31
- },
32
- "subscriptions": {
33
- "demo_sub": {
34
- "queue": "demo_q"
35
- }
36
31
  }
37
32
  }
38
33
  }
package/lib/amqp/Vhost.js CHANGED
@@ -201,7 +201,8 @@ function Vhost(vhostConfig, components) {
201
201
  createChannelWhenInitialised(options.confirm, (err, channel) => {
202
202
  if (err) return deferRejection(reject, err);
203
203
  if (!channel) return deferRejection(reject, new Error('Vhost is shutting down'));
204
- const destroyChannel = _.once(() => {
204
+ const destroyChannel = _.once((err) => {
205
+ console.log('Destroying channel', err);
205
206
  debug('Destroying %s channel: %s for vhost: %s due to error or close event', mode, channel._rascal_id, vhostConfig.name);
206
207
  channel._rascal_closed = true;
207
208
  if (pool.isBorrowedResource(channel)) {
@@ -289,11 +290,7 @@ function Vhost(vhostConfig, components) {
289
290
  .catch((err) => {
290
291
  debug('Error releasing %s channel: %s. %s', mode, channel._rascal_id, err.message);
291
292
  })
292
- .then(() => {
293
- if (poolQueue.length() > 0 || !busy) return;
294
- busy = false;
295
- self.emit('ready', stats());
296
- });
293
+ .then(() => checkReady());
297
294
  }
298
295
 
299
296
  function destroy(channel) {
@@ -303,11 +300,13 @@ function Vhost(vhostConfig, components) {
303
300
  .catch((err) => {
304
301
  debug('Error destroying %s channel: %s. %s', mode, channel._rascal_id, err.message);
305
302
  })
306
- .then(() => {
307
- if (poolQueue.length() > 0 || !busy) return;
308
- busy = false;
309
- self.emit('ready', stats());
310
- });
303
+ .then(() => checkReady());
304
+ }
305
+
306
+ function checkReady() {
307
+ if (poolQueue.length() > 0 || !busy) return;
308
+ busy = false;
309
+ self.emit('ready', stats());
311
310
  }
312
311
 
313
312
  function drain(next) {
@@ -376,7 +375,7 @@ function Vhost(vhostConfig, components) {
376
375
  }
377
376
  if (!connection) return next(new Error(format('Vhost: %s must be initialised before you can create a channel', self.name)));
378
377
 
379
- // Same problem as https://github.com/guidesmiths/rascal/issues/17
378
+ // Same problem as https://github.com/onebeyond/rascal/issues/17
380
379
  const once = _.once(next);
381
380
  let invocations = 0;
382
381
  const channelId = uuid();
@@ -31,7 +31,7 @@ module.exports = _.curry((config, ctx, next) => {
31
31
  function connect(connectionConfig, cb) {
32
32
  debug('Connecting to broker using url: %s', connectionConfig.loggableUrl);
33
33
 
34
- // See https://github.com/guidesmiths/rascal/issues/17
34
+ // See https://github.com/onebeyond/rascal/issues/17
35
35
  const once = _.once(cb);
36
36
  let invocations = 0;
37
37
 
@@ -91,7 +91,7 @@ module.exports = _.curry((rascalConfig, next) => {
91
91
  } = new URL(connectionString);
92
92
  const options = Array.from(searchParams).reduce((attributes, entry) => ({ ...attributes, [entry[0]]: entry[1] }), {});
93
93
  return {
94
- protocol, hostname, port, user, password, vhost, options,
94
+ protocol, hostname: decodeURIComponent(hostname), port, user: decodeURIComponent(user), password: decodeURIComponent(password), vhost: decodeURIComponent(vhost), options,
95
95
  };
96
96
  }
97
97
 
@@ -105,10 +105,14 @@ module.exports = _.curry((rascalConfig, next) => {
105
105
  }
106
106
 
107
107
  function configureManagementConnection(vhostConfig, vhostName, connection) {
108
- _.defaultsDeep(connection.management, { hostname: connection.hostname });
109
- const auth = connection.management.auth || getAuth(connection.management.user, connection.management.password) || getAuth(connection.user, connection.password);
110
- connection.management.url = connection.management.url || url.format({ ...connection.management, auth });
111
- connection.management.loggableUrl = connection.management.url.replace(/:[^:]*?@/, ':***@');
108
+ connection.management = _.isString(connection.management) ? { url: connection.management } : connection.management;
109
+ const attributesFromUrl = parseConnectionUrl(connection.management.url);
110
+ const attributesFromConfig = getConnectionAttributes(connection.management);
111
+ const defaults = { user: connection.user, password: connection.password, hostname: connection.hostname };
112
+
113
+ const connectionAttributes = _.defaultsDeep({ options: null }, attributesFromUrl, attributesFromConfig, defaults);
114
+ setConnectionAttributes(connection.management, connectionAttributes);
115
+ setConnectionUrls(connection.management);
112
116
  }
113
117
 
114
118
  function setConnectionAttributes(connection, attributes, defaults) {
@@ -120,7 +124,6 @@ module.exports = _.curry((rascalConfig, next) => {
120
124
  const auth = getAuth(connection.user, connection.password);
121
125
  const pathname = connection.vhost === '/' ? '' : connection.vhost;
122
126
  const query = connection.options;
123
-
124
127
  connection.url = url.format({
125
128
  slashes: true, ...connection, auth, pathname, query,
126
129
  });
@@ -132,7 +135,7 @@ module.exports = _.curry((rascalConfig, next) => {
132
135
  }
133
136
 
134
137
  function setConnectionIndex(connection, strategy, index) {
135
- connection.index = strategy === 'fixed' ? index : getConnectionIndex(strategy, `${connection.host}:${connection.port}`);
138
+ connection.index = strategy === 'fixed' ? index : getConnectionIndex(strategy, `${connection.hostname}:${connection.port}`);
136
139
  }
137
140
 
138
141
  function getConnectionIndex(strategy, hostname) {
@@ -1,4 +1,4 @@
1
- // See https://github.com/guidesmiths/rascal/issues/89
1
+ // See https://github.com/onebeyond/rascal/issues/89
2
2
  module.exports = function (fn, millis) {
3
3
  const t = setTimeout(fn, millis);
4
4
  return t.unref ? t.unref() : t;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rascal",
3
- "version": "17.0.1",
3
+ "version": "18.0.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": {
@@ -59,12 +59,12 @@
59
59
  ],
60
60
  "repository": {
61
61
  "type": "git",
62
- "url": "https://github.com/guidesmiths/rascal.git"
62
+ "url": "https://github.com/onebeyond/rascal.git"
63
63
  },
64
64
  "bugs": {
65
- "url": "https://github.com/guidesmiths/rascal/issues"
65
+ "url": "https://github.com/onebeyond/rascal/issues"
66
66
  },
67
- "homepage": "https://guidesmiths.github.io/rascal/",
67
+ "homepage": "https://onebeyond.github.io/rascal/",
68
68
  "author": "Stephen Cresswell",
69
69
  "license": "MIT",
70
70
  "zUnit": {