rascal 17.0.1 → 17.0.2

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,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 17.0.2
4
+
5
+ - Update guidesmiths references to onebeyond.
6
+ - Dedupe channel poole ready check
7
+ - Remove unnecessary subscription config from busy publisher example
8
+ - Fixed bug where hostname connection order was not properly randomised
9
+
3
10
  ## 17.0.1
4
11
 
5
12
  - Rework the republish and forward recovery strategies to remove remote chance of repeat ack/nack
6
13
 
7
14
  ## 17.0.0
8
15
 
9
- - Updated the configuration processing as per https://github.com/guidesmiths/rascal/issues/219
16
+ - Updated the configuration processing as per https://github.com/onebeyond/rascal/issues/219
10
17
  - Test on Node 20
11
18
  - Abandon dependabot (too noisy)
12
19
  - Bump deps
13
- - Add support for channel level prefetch as per https://github.com/guidesmiths/rascal/issues/221
20
+ - Add support for channel level prefetch as per https://github.com/onebeyond/rascal/issues/221
14
21
  - Dropped prettier (it does nothing of the sort!)
15
22
 
16
23
  ## 16.3.0
@@ -45,7 +52,7 @@
45
52
 
46
53
  ## 15.0.1
47
54
 
48
- - Fix MaxListenersExceeded warning when there are more than 10 vhosts - See https://github.com/guidesmiths/rascal/issues/206
55
+ - Fix MaxListenersExceeded warning when there are more than 10 vhosts - See https://github.com/onebeyond/rascal/issues/206
49
56
 
50
57
  ## 15.0.0
51
58
 
@@ -54,11 +61,11 @@
54
61
 
55
62
  ## 14.4.5
56
63
 
57
- - Fixed issue where a partial password could be logged in debug - See https://github.com/guidesmiths/rascal/issues/200 - thanks @matt1097
64
+ - Fixed issue where a partial password could be logged in debug - See https://github.com/onebeyond/rascal/issues/200 - thanks @matt1097
58
65
 
59
66
  ## 14.4.4
60
67
 
61
- - Fixed issue where channels were not returned to the pool after publishing a large messag - See https://github.com/guidesmiths/rascal/issues/199
68
+ - Fixed issue where channels were not returned to the pool after publishing a large messag - See https://github.com/onebeyond/rascal/issues/199
62
69
 
63
70
  ## 14.4.3
64
71
 
@@ -81,15 +88,15 @@
81
88
  ## 14.4.1
82
89
 
83
90
  - Bump dependencies / fix audit warnings
84
- - Fix busy publisher example to consistenly use regular channels - See https://github.com/guidesmiths/rascal/issues/194
91
+ - Fix busy publisher example to consistenly use regular channels - See https://github.com/onebeyond/rascal/issues/194
85
92
 
86
93
  ## 14.4.0
87
94
 
88
- - Report validation error when no vhosts are specified - See https://github.com/guidesmiths/rascal/issues/181
95
+ - Report validation error when no vhosts are specified - See https://github.com/onebeyond/rascal/issues/181
89
96
 
90
97
  ## 14.3.0
91
98
 
92
- - Clone config instead of freezing it so buffers will work - See https://github.com/guidesmiths/rascal/issues/92
99
+ - Clone config instead of freezing it so buffers will work - See https://github.com/onebeyond/rascal/issues/92
93
100
 
94
101
  ## 14.2.1
95
102
 
@@ -97,15 +104,15 @@
97
104
 
98
105
  ## 14.2.0
99
106
 
100
- - Add json schema (lib/config/schema.json) - See https://github.com/guidesmiths/rascal/issues/168
107
+ - Add json schema (lib/config/schema.json) - See https://github.com/onebeyond/rascal/issues/168
101
108
 
102
109
  ## 14.1.0
103
110
 
104
- - Adds support for custom user agents - See https://github.com/guidesmiths/rascal/issues/170
111
+ - Adds support for custom user agents - See https://github.com/onebeyond/rascal/issues/170
105
112
 
106
113
  ## 14.0.1
107
114
 
108
- - Fixes https://github.com/guidesmiths/rascal/issues/178
115
+ - Fixes https://github.com/onebeyond/rascal/issues/178
109
116
 
110
117
  ## 14.0.0
111
118
 
@@ -126,15 +133,15 @@
126
133
 
127
134
  ## 13.1.2
128
135
 
129
- - Fixed various issues when queue names contained period characters. Reported in https://github.com/guidesmiths/rascal/issues/166
136
+ - Fixed various issues when queue names contained period characters. Reported in https://github.com/onebeyond/rascal/issues/166
130
137
 
131
138
  ## 13.1.1
132
139
 
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.
140
+ - 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
141
 
135
142
  ## 13.1.0
136
143
 
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.
144
+ - 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
145
 
139
146
  ## 13.0.6
140
147
 
@@ -147,7 +154,7 @@
147
154
 
148
155
  ## 13.0.4
149
156
 
150
- - Fixed https://github.com/guidesmiths/rascal/issues/156
157
+ - Fixed https://github.com/onebeyond/rascal/issues/156
151
158
 
152
159
  ## 13.0.3
153
160
 
@@ -155,7 +162,7 @@
155
162
 
156
163
  ## 13.0.2
157
164
 
158
- - Fixed https://github.com/guidesmiths/rascal/issues/150
165
+ - Fixed https://github.com/onebeyond/rascal/issues/150
159
166
 
160
167
  ## 13.0.1
161
168
 
@@ -175,7 +182,7 @@
175
182
 
176
183
  ## 12.0.3
177
184
 
178
- - Fix https://github.com/guidesmiths/rascal/issues/141
185
+ - Fix https://github.com/onebeyond/rascal/issues/141
179
186
  - Fix error message typos
180
187
  - Bump lodash
181
188
 
@@ -186,7 +193,7 @@
186
193
  ## 12.0.1
187
194
 
188
195
  - 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)
196
+ - Fix broker waiting indefinitely when shutdown is called after losing a connection. See [#126](https://github.com/onebeyond/rascal/issues/126)
190
197
 
191
198
  ## 12.0.0
192
199
 
@@ -214,29 +221,29 @@
214
221
 
215
222
  ### Updated
216
223
 
217
- - Improved readme as per issue [#111](https://github.com/guidesmiths/rascal/issues/111)
224
+ - Improved readme as per issue [#111](https://github.com/onebeyond/rascal/issues/111)
218
225
 
219
226
  ### Fixed
220
227
 
221
- - Fixed issue [#123](https://github.com/guidesmiths/rascal/issues/123), where a race condition was causing channels to be closed twice. Thanks @cinnq346.
228
+ - Fixed issue [#123](https://github.com/onebeyond/rascal/issues/123), where a race condition was causing channels to be closed twice. Thanks @cinnq346.
222
229
 
223
230
  ## 10.2.4
224
231
 
225
232
  ### Fixed
226
233
 
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
234
+ - 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
235
 
229
236
  ## 10.2.3
230
237
 
231
238
  ### Fixed
232
239
 
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
240
+ - 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
241
 
235
242
  ## 10.2.2
236
243
 
237
244
  ### Fixed
238
245
 
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.
246
+ - 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
247
 
241
248
  ## 10.2.1
242
249
 
@@ -265,7 +272,7 @@
265
272
 
266
273
  ### Updated
267
274
 
268
- - Set vhost max event listeners to inifinity (see https://github.com/guidesmiths/rascal/issues/99)
275
+ - Set vhost max event listeners to inifinity (see https://github.com/onebeyond/rascal/issues/99)
269
276
 
270
277
  ## 10.0.0
271
278
 
@@ -289,13 +296,13 @@
289
296
 
290
297
  ### Updated
291
298
 
292
- - [Fixed #78](https://github.com/guidesmiths/rascal/issues/78) by using a baseline config, and only laying connection options via withDefaultConfig
299
+ - [Fixed #78](https://github.com/onebeyond/rascal/issues/78) by using a baseline config, and only laying connection options via withDefaultConfig
293
300
 
294
301
  ## 9.2.0
295
302
 
296
303
  ### Added
297
304
 
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.
305
+ - [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
306
 
300
307
  ### Updated
301
308
 
@@ -347,8 +354,8 @@
347
354
 
348
355
  ### Updated
349
356
 
350
- - Fixed [#86](https://github.com/guidesmiths/rascal/issues/85)
351
- - Fixed [#84](https://github.com/guidesmiths/rascal/issues/84). Thanks @huikaihoo
357
+ - Fixed [#86](https://github.com/onebeyond/rascal/issues/85)
358
+ - Fixed [#84](https://github.com/onebeyond/rascal/issues/84). Thanks @huikaihoo
352
359
 
353
360
  ### Added
354
361
 
@@ -358,14 +365,14 @@
358
365
 
359
366
  ### Updated
360
367
 
361
- - emit error when publishFn err Channel closed as oer https://github.com/guidesmiths/rascal/pull/81. Thanks @zijin-m
368
+ - emit error when publishFn err Channel closed as oer https://github.com/onebeyond/rascal/pull/81. Thanks @zijin-m
362
369
 
363
370
  ## 8.0.0
364
371
 
365
372
  ### Updated
366
373
 
367
374
  - Drop support for Node 6
368
- - Updated dependencies as per https://github.com/guidesmiths/rascal/pull/75. Thanks @ravihara
375
+ - Updated dependencies as per https://github.com/onebeyond/rascal/pull/75. Thanks @ravihara
369
376
 
370
377
  ## 7.0.0
371
378
 
@@ -378,7 +385,7 @@
378
385
 
379
386
  ### Fixed
380
387
 
381
- - Fixed [#72](https://github.com/guidesmiths/rascal/issues/72) which meant published messages waiting for a channel would be lost on connection error
388
+ - Fixed [#72](https://github.com/onebeyond/rascal/issues/72) which meant published messages waiting for a channel would be lost on connection error
382
389
 
383
390
  ## 6.0.2
384
391
 
@@ -392,7 +399,7 @@
392
399
 
393
400
  ## 6.0.0
394
401
 
395
- - Improved channel pool management (includes a breaking config change - see https://github.com/guidesmiths/rascal#channel-pooling).
402
+ - Improved channel pool management (includes a breaking config change - see https://github.com/onebeyond/rascal#channel-pooling).
396
403
 
397
404
  ## 5.1.0
398
405
 
@@ -585,7 +592,7 @@
585
592
  ### Updated
586
593
 
587
594
  - 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
595
+ - Unqualified default publications and subscriptions are no longer supported. See https://github.com/onebeyond/rascal/issues/20
589
596
  - Testing on node 10
590
597
 
591
598
  ## 2.12.2
@@ -726,7 +733,7 @@
726
733
 
727
734
  ### Fixed
728
735
 
729
- - confirmPoolSize option as per https://github.com/guidesmiths/rascal/pull/19
736
+ - confirmPoolSize option as per https://github.com/onebeyond/rascal/pull/19
730
737
 
731
738
  ## 1.4.0
732
739
 
@@ -755,7 +762,7 @@
755
762
 
756
763
  ### Added
757
764
 
758
- - Workaround for https://github.com/guidesmiths/rascal/issues/17
765
+ - Workaround for https://github.com/onebeyond/rascal/issues/17
759
766
 
760
767
  ## 1.1.0
761
768
 
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
 
@@ -53,7 +53,7 @@ Rascal@14 waits for inflight messages to be acknowledged before closing subscrib
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
 
@@ -1401,7 +1401,7 @@ Rascal provides three counter implementations:
1401
1401
  2. inMemory - useful only for testing since if your node process crashes, the counter will be vaporised too
1402
1402
  3. inMemoryCluster - like the inMemory, but since the counter resides in the master it survives worker crashes.
1403
1403
 
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.
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/onebeyond/rascal/tree/master/examples/advanced) for how to configure it.
1405
1405
 
1406
1406
  #### Implementing your own counter
1407
1407
 
@@ -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
 
@@ -132,7 +132,7 @@ module.exports = _.curry((rascalConfig, next) => {
132
132
  }
133
133
 
134
134
  function setConnectionIndex(connection, strategy, index) {
135
- connection.index = strategy === 'fixed' ? index : getConnectionIndex(strategy, `${connection.host}:${connection.port}`);
135
+ connection.index = strategy === 'fixed' ? index : getConnectionIndex(strategy, `${connection.hostname}:${connection.port}`);
136
136
  }
137
137
 
138
138
  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": "17.0.2",
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": {