typespeed 2.0.13 → 2.0.16
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/dist/core.decorator.js +0 -1
- package/dist/database.decorator.js +0 -1
- package/dist/default/express-server.class.js +0 -1
- package/dist/default/log-default.class.js +0 -1
- package/dist/default/node-cache.class.js +0 -1
- package/dist/default/rabbitmq.class.js +0 -1
- package/dist/default/read-write-db.class.js +0 -1
- package/dist/default/redis.class.js +0 -1
- package/dist/factory/cache-factory.class.js +0 -1
- package/dist/factory/data-source-factory.class.js +0 -1
- package/dist/factory/log-factory.class.js +0 -1
- package/dist/factory/server-factory.class.js +0 -1
- package/dist/route.decorator.js +0 -1
- package/dist/scaffold/command.js +0 -1
- package/dist/typespeed.d.ts +133 -12
- package/dist/typespeed.js +1 -1
- package/package.json +2 -2
- package/src/typespeed.d.ts +133 -0
- package/src/typespeed.ts +2 -1
- package/test/node_modules/.package-lock.json +112 -4
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +17 -0
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +30 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE +6 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +21 -0
- package/test/node_modules/@acuminous/bitsyntax/Makefile +15 -0
- package/test/node_modules/@acuminous/bitsyntax/README.md +308 -0
- package/test/node_modules/@acuminous/bitsyntax/index.js +10 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +303 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +142 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +67 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +232 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +32 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +1173 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +119 -0
- package/test/node_modules/@acuminous/bitsyntax/package.json +36 -0
- package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +50 -0
- package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +193 -0
- package/test/node_modules/@types/node/README.md +1 -1
- package/test/node_modules/@types/node/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/globals.d.ts +1 -0
- package/test/node_modules/@types/node/package.json +2 -2
- package/test/node_modules/@types/node/test.d.ts +43 -20
- package/test/node_modules/@types/node/ts4.8/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/ts4.8/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
- package/test/node_modules/@types/node/ts4.8/test.d.ts +43 -19
- package/test/node_modules/@types/node/ts4.8/url.d.ts +3 -3
- package/test/node_modules/@types/node/ts4.8/util.d.ts +1 -1
- package/test/node_modules/@types/node/url.d.ts +3 -3
- package/test/node_modules/@types/node/util.d.ts +1 -1
- package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/test/node_modules/amqplib/.github/workflows/test.yml +38 -0
- package/test/node_modules/amqplib/CHANGELOG.md +430 -0
- package/test/node_modules/amqplib/LICENSE +6 -0
- package/test/node_modules/amqplib/LICENSE-MIT +21 -0
- package/test/node_modules/amqplib/Makefile +47 -0
- package/test/node_modules/amqplib/README.md +157 -0
- package/test/node_modules/amqplib/bin/generate-defs.js +722 -0
- package/test/node_modules/amqplib/callback_api.js +22 -0
- package/test/node_modules/amqplib/channel_api.js +16 -0
- package/test/node_modules/amqplib/examples/headers.js +42 -0
- package/test/node_modules/amqplib/examples/receive_generator.js +39 -0
- package/test/node_modules/amqplib/examples/send_generators.js +42 -0
- package/test/node_modules/amqplib/examples/ssl.js +64 -0
- package/test/node_modules/amqplib/examples/tutorials/README.md +93 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +36 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +56 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +55 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +49 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +45 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +29 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +35 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +20 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/new_task.js +18 -0
- package/test/node_modules/amqplib/examples/tutorials/package.json +16 -0
- package/test/node_modules/amqplib/examples/tutorials/receive.js +21 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +44 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +43 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +52 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +39 -0
- package/test/node_modules/amqplib/examples/tutorials/send.js +23 -0
- package/test/node_modules/amqplib/examples/tutorials/worker.js +28 -0
- package/test/node_modules/amqplib/examples/waitForConfirms.js +22 -0
- package/test/node_modules/amqplib/lib/api_args.js +314 -0
- package/test/node_modules/amqplib/lib/bitset.js +130 -0
- package/test/node_modules/amqplib/lib/callback_model.js +327 -0
- package/test/node_modules/amqplib/lib/channel.js +499 -0
- package/test/node_modules/amqplib/lib/channel_model.js +302 -0
- package/test/node_modules/amqplib/lib/codec.js +321 -0
- package/test/node_modules/amqplib/lib/connect.js +189 -0
- package/test/node_modules/amqplib/lib/connection.js +663 -0
- package/test/node_modules/amqplib/lib/credentials.js +42 -0
- package/test/node_modules/amqplib/lib/defs.js +4966 -0
- package/test/node_modules/amqplib/lib/error.js +24 -0
- package/test/node_modules/amqplib/lib/format.js +40 -0
- package/test/node_modules/amqplib/lib/frame.js +113 -0
- package/test/node_modules/amqplib/lib/heartbeat.js +89 -0
- package/test/node_modules/amqplib/lib/mux.js +129 -0
- package/test/node_modules/amqplib/package.json +37 -0
- package/test/node_modules/amqplib/test/bitset.js +69 -0
- package/test/node_modules/amqplib/test/callback_api.js +312 -0
- package/test/node_modules/amqplib/test/channel.js +621 -0
- package/test/node_modules/amqplib/test/channel_api.js +596 -0
- package/test/node_modules/amqplib/test/codec.js +237 -0
- package/test/node_modules/amqplib/test/connect.js +197 -0
- package/test/node_modules/amqplib/test/connection.js +390 -0
- package/test/node_modules/amqplib/test/data.js +254 -0
- package/test/node_modules/amqplib/test/frame.js +198 -0
- package/test/node_modules/amqplib/test/mux.js +204 -0
- package/test/node_modules/amqplib/test/util.js +219 -0
- package/test/node_modules/buffer-more-ints/.travis.yml +6 -0
- package/test/node_modules/buffer-more-ints/LICENSE +19 -0
- package/test/node_modules/buffer-more-ints/README.md +69 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +183 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints.js +432 -0
- package/test/node_modules/buffer-more-ints/package.json +19 -0
- package/test/node_modules/buffer-more-ints/polyfill.js +71 -0
- package/test/node_modules/core-util-is/LICENSE +19 -0
- package/test/node_modules/core-util-is/README.md +3 -0
- package/test/node_modules/core-util-is/lib/util.js +107 -0
- package/test/node_modules/core-util-is/package.json +38 -0
- package/test/node_modules/debug/LICENSE +20 -0
- package/test/node_modules/debug/README.md +481 -0
- package/test/node_modules/debug/package.json +59 -0
- package/test/node_modules/debug/src/browser.js +269 -0
- package/test/node_modules/debug/src/common.js +274 -0
- package/test/node_modules/debug/src/index.js +10 -0
- package/test/node_modules/debug/src/node.js +263 -0
- package/test/node_modules/inherits/LICENSE +16 -0
- package/test/node_modules/inherits/README.md +42 -0
- package/test/node_modules/inherits/inherits.js +9 -0
- package/test/node_modules/inherits/inherits_browser.js +27 -0
- package/test/node_modules/inherits/package.json +29 -0
- package/test/node_modules/isarray/README.md +54 -0
- package/test/node_modules/isarray/build/build.js +209 -0
- package/test/node_modules/isarray/component.json +19 -0
- package/test/node_modules/isarray/index.js +3 -0
- package/test/node_modules/isarray/package.json +25 -0
- package/test/node_modules/ms/index.js +162 -0
- package/test/node_modules/ms/license.md +21 -0
- package/test/node_modules/ms/package.json +37 -0
- package/test/node_modules/ms/readme.md +60 -0
- package/test/node_modules/querystringify/LICENSE +22 -0
- package/test/node_modules/querystringify/README.md +61 -0
- package/test/node_modules/querystringify/index.js +118 -0
- package/test/node_modules/querystringify/package.json +38 -0
- package/test/node_modules/readable-stream/LICENSE +18 -0
- package/test/node_modules/readable-stream/README.md +15 -0
- package/test/node_modules/readable-stream/duplex.js +1 -0
- package/test/node_modules/readable-stream/float.patch +923 -0
- package/test/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
- package/test/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
- package/test/node_modules/readable-stream/lib/_stream_readable.js +951 -0
- package/test/node_modules/readable-stream/lib/_stream_transform.js +209 -0
- package/test/node_modules/readable-stream/lib/_stream_writable.js +477 -0
- package/test/node_modules/readable-stream/package.json +32 -0
- package/test/node_modules/readable-stream/passthrough.js +1 -0
- package/test/node_modules/readable-stream/readable.js +10 -0
- package/test/node_modules/readable-stream/transform.js +1 -0
- package/test/node_modules/readable-stream/writable.js +1 -0
- package/test/node_modules/requires-port/.travis.yml +19 -0
- package/test/node_modules/requires-port/LICENSE +22 -0
- package/test/node_modules/requires-port/README.md +47 -0
- package/test/node_modules/requires-port/index.js +38 -0
- package/test/node_modules/requires-port/package.json +47 -0
- package/test/node_modules/requires-port/test.js +98 -0
- package/test/node_modules/safe-buffer/LICENSE +21 -0
- package/test/node_modules/safe-buffer/README.md +584 -0
- package/test/node_modules/safe-buffer/index.d.ts +187 -0
- package/test/node_modules/safe-buffer/index.js +62 -0
- package/test/node_modules/safe-buffer/package.json +37 -0
- package/test/node_modules/string_decoder/LICENSE +20 -0
- package/test/node_modules/string_decoder/README.md +7 -0
- package/test/node_modules/string_decoder/index.js +221 -0
- package/test/node_modules/string_decoder/package.json +25 -0
- package/test/node_modules/url-parse/LICENSE +22 -0
- package/test/node_modules/url-parse/README.md +153 -0
- package/test/node_modules/url-parse/dist/url-parse.js +755 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js +1 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js.map +1 -0
- package/test/node_modules/url-parse/index.js +589 -0
- package/test/node_modules/url-parse/package.json +49 -0
- package/test/src/test-mq.class.ts +1 -2
- package/tsconfig.json +4 -3
- package/dist/core.decorator.d.ts +0 -18
- package/dist/core.decorator.js.map +0 -1
- package/dist/database.decorator.d.ts +0 -24
- package/dist/database.decorator.js.map +0 -1
- package/dist/default/express-server.class.d.ts +0 -15
- package/dist/default/express-server.class.js.map +0 -1
- package/dist/default/log-default.class.d.ts +0 -6
- package/dist/default/log-default.class.js.map +0 -1
- package/dist/default/node-cache.class.d.ts +0 -13
- package/dist/default/node-cache.class.js.map +0 -1
- package/dist/default/rabbitmq.class.d.ts +0 -9
- package/dist/default/rabbitmq.class.js.map +0 -1
- package/dist/default/read-write-db.class.d.ts +0 -10
- package/dist/default/read-write-db.class.js.map +0 -1
- package/dist/default/redis.class.d.ts +0 -5
- package/dist/default/redis.class.js.map +0 -1
- package/dist/factory/cache-factory.class.d.ts +0 -7
- package/dist/factory/cache-factory.class.js.map +0 -1
- package/dist/factory/data-source-factory.class.d.ts +0 -4
- package/dist/factory/data-source-factory.class.js.map +0 -1
- package/dist/factory/log-factory.class.d.ts +0 -4
- package/dist/factory/log-factory.class.js.map +0 -1
- package/dist/factory/server-factory.class.d.ts +0 -6
- package/dist/factory/server-factory.class.js.map +0 -1
- package/dist/route.decorator.d.ts +0 -8
- package/dist/route.decorator.js.map +0 -1
- package/dist/scaffold/command.d.ts +0 -2
- package/dist/scaffold/command.js.map +0 -1
- package/dist/typespeed.js.map +0 -1
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Change log for amqplib
|
|
2
|
+
|
|
3
|
+
## Changes in v0.10.3
|
|
4
|
+
|
|
5
|
+
git log v0.10.2..v0.10.3
|
|
6
|
+
|
|
7
|
+
- Use @acuminous/bitsyntax fork. See https://github.com/amqp-node/amqplib/issues/453
|
|
8
|
+
|
|
9
|
+
## Changes in v0.10.2
|
|
10
|
+
|
|
11
|
+
git log v0.10.1..v0.10.2
|
|
12
|
+
|
|
13
|
+
- Use Buffer.allocUnsafe when sending messages to improve performance ([PR
|
|
14
|
+
695](https://github.com/amqp-node/amqplib/pull/695), thank you
|
|
15
|
+
@chkimes and @Uzlopak)
|
|
16
|
+
|
|
17
|
+
## Changes in v0.10.1
|
|
18
|
+
|
|
19
|
+
git log v0.10.0..v0.10.1
|
|
20
|
+
|
|
21
|
+
* Allow servername to be specified via socket options as discussed in as discussed in
|
|
22
|
+
[issue 697](https://github.com/squaremo/amqp.node/issues/697)
|
|
23
|
+
|
|
24
|
+
## Changes in v0.10.0
|
|
25
|
+
|
|
26
|
+
git log v0.9.1..v0.10.0
|
|
27
|
+
|
|
28
|
+
* Use Native promises ([PR
|
|
29
|
+
689](https://github.com/amqp-node/amqplib/pull/689), thank you
|
|
30
|
+
@mohd-akram and @kibertoad)
|
|
31
|
+
|
|
32
|
+
## Changes in v0.9.1
|
|
33
|
+
|
|
34
|
+
git log v0.9.0..v0.9.1
|
|
35
|
+
|
|
36
|
+
* Assorted readme changes
|
|
37
|
+
* Use Array.prototype.push.apply instead of concat in Mux ([PR
|
|
38
|
+
658](https://github.com/squaremo/amqp.node/pull/658), thank you
|
|
39
|
+
@Uzlopak and @kibertoad)
|
|
40
|
+
* Use Map instead of Object for BaseChannel.consumers ([PR
|
|
41
|
+
660](https://github.com/squaremo/amqp.node/pull/660), thank you
|
|
42
|
+
@Uzlopak)
|
|
43
|
+
* Delete consumer callback after cancellation to free memory ([PR
|
|
44
|
+
659](https://github.com/squaremo/amqp.node/pull/659), thank you
|
|
45
|
+
@Uzlopak and @kibertoad)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Changes in v0.9.0
|
|
49
|
+
|
|
50
|
+
git log v0.8.0..v0.9.0
|
|
51
|
+
|
|
52
|
+
* Update mocha and replace the deprecated istanbul with nyc ([PR
|
|
53
|
+
681](https://github.com/squaremo/amqp.node/pull/681)
|
|
54
|
+
* Update url-parse ([PR
|
|
55
|
+
675](https://github.com/squaremo/amqp.node/pull/675), thank you
|
|
56
|
+
@suhail-n and @kibertoad)
|
|
57
|
+
* fix: done called twice on invalid options ([PR
|
|
58
|
+
667](https://github.com/squaremo/amqp.node/pull/667), thank you
|
|
59
|
+
@luddd3 and @kibertoad)
|
|
60
|
+
* Close connection to server on connect errors ([PR
|
|
61
|
+
647](https://github.com/squaremo/amqp.node/pull/647), thank you
|
|
62
|
+
@luddd3 and @kibertoad)
|
|
63
|
+
* Modernise channel_model.js ([PR
|
|
64
|
+
635](https://github.com/squaremo/amqp.node/pull/635), thank you
|
|
65
|
+
@kibertoad and @jimmywarting)
|
|
66
|
+
* Bring package-lock.json up to date ([PR
|
|
67
|
+
653](https://github.com/squaremo/amqp.node/pull/653)
|
|
68
|
+
* Update url-parse ([PR
|
|
69
|
+
652](https://github.com/squaremo/amqp.node/pull/652), thank you
|
|
70
|
+
@giorgioatanasov and @buffolander)
|
|
71
|
+
* Modernise channel_model.js ([PR
|
|
72
|
+
651](https://github.com/squaremo/amqp.node/pull/651), thank you
|
|
73
|
+
for the review @kibertoad)
|
|
74
|
+
* Modernise bitset.js ([PR
|
|
75
|
+
634](https://github.com/squaremo/amqp.node/pull/634), thank you
|
|
76
|
+
@kibertoad and @jimmywarting)
|
|
77
|
+
* :warning: Drop CI for node versions below 10 ([PR
|
|
78
|
+
631](https://github.com/squaremo/amqp.node/pull/631), thank you
|
|
79
|
+
for the review @kibertoad)
|
|
80
|
+
* Replace safe-buffer dependency with native buffers ([PR
|
|
81
|
+
628](https://github.com/squaremo/amqp.node/pull/628), thank you
|
|
82
|
+
@kibertoad and @jimmywarting)
|
|
83
|
+
|
|
84
|
+
## Changes in v0.8.0
|
|
85
|
+
|
|
86
|
+
git log v0.7.1..v0.8.0
|
|
87
|
+
|
|
88
|
+
* :warning: Support for NodeJS prior to v10 is dropped :warning: ([PR
|
|
89
|
+
615](https://github.com/squaremo/amqp.node/pull/615), thank you
|
|
90
|
+
@xamgore and everyone who helped there)
|
|
91
|
+
* Use hostname as TLS servername, to help with using servers behind
|
|
92
|
+
load balancers ([PR
|
|
93
|
+
567](https://github.com/squaremo/amqp.node/pull/567), thanks to
|
|
94
|
+
@carlhoerberg and commenters)
|
|
95
|
+
|
|
96
|
+
## Changes in v0.7.1
|
|
97
|
+
|
|
98
|
+
git log v0.7.0..v0.7.1
|
|
99
|
+
|
|
100
|
+
* Update url-parse (and others) ([PR
|
|
101
|
+
607](https://github.com/squaremo/amqp.node/pull/545), thanks
|
|
102
|
+
@ThomasGawlitza)
|
|
103
|
+
|
|
104
|
+
## Changes in v0.7.0
|
|
105
|
+
|
|
106
|
+
git log v0.6.0..v0.7.0
|
|
107
|
+
|
|
108
|
+
* Extend support to Node.js v15
|
|
109
|
+
* Fix use of stream.write in tests
|
|
110
|
+
|
|
111
|
+
## Changes in v0.6.0
|
|
112
|
+
|
|
113
|
+
git log v0.5.6..v0.6.0
|
|
114
|
+
|
|
115
|
+
* Extend support to Node.js v14
|
|
116
|
+
|
|
117
|
+
## Changes in v0.5.6
|
|
118
|
+
|
|
119
|
+
git log v0.5.5..v0.5.6
|
|
120
|
+
|
|
121
|
+
* Increase size of encoding space for message headers, to fit e.g.,
|
|
122
|
+
JWT ([PR 545](https://github.com/squaremo/amqp.node/pull/545));
|
|
123
|
+
thanks @twatson83
|
|
124
|
+
* Switch to a non-deprecated UUID module ([PR
|
|
125
|
+
528](https://github.com/squaremo/amqp.node/pull/528)); thanks to
|
|
126
|
+
@StrayBird-ATSH
|
|
127
|
+
* Fix a bug in multiplexing that caused an assertion to fail ([PR
|
|
128
|
+
503](https://github.com/squaremo/amqp.node/pull/503)); thanks
|
|
129
|
+
@johanneswuerbach
|
|
130
|
+
|
|
131
|
+
## Changes in v0.5.5
|
|
132
|
+
|
|
133
|
+
git log v0.5.3..v0.5.5
|
|
134
|
+
|
|
135
|
+
**NB** this includes a minor but possibly breaking change: after [PR
|
|
136
|
+
498](https://github.com/squaremo/amqp.node/pull/498), all confirmation
|
|
137
|
+
promises still unresolved will be rejected when their associated
|
|
138
|
+
channel is closed.
|
|
139
|
+
|
|
140
|
+
* Generate defs in `npm prepare` rather than `npm prepublish` so that
|
|
141
|
+
e.g., amqplib can be installed via git ([part of PR
|
|
142
|
+
498](https://github.com/squaremo/amqp.node/pull/498))
|
|
143
|
+
* Reject all pending confirmations when the channel is closed ([PR
|
|
144
|
+
498](https://github.com/squaremo/amqp.node/pull/498)); thanks
|
|
145
|
+
@johanneswuerbach
|
|
146
|
+
* Update supported NodeJS versions in package.json ([PR
|
|
147
|
+
525](https://github.com/squaremo/amqp.node/pull/525)); thanks
|
|
148
|
+
@tingwai
|
|
149
|
+
|
|
150
|
+
## (Deprecated v0.5.4)
|
|
151
|
+
|
|
152
|
+
This release was mistakenly published without the generated file
|
|
153
|
+
`./defs.js`. It has been deprecated in favour of v0.5.5.
|
|
154
|
+
|
|
155
|
+
## Changes in v0.5.3
|
|
156
|
+
|
|
157
|
+
git log v0.5.2..v0.5.3
|
|
158
|
+
|
|
159
|
+
* Bump bitsyntax to remove some `Buffer` misuse deprecation notices
|
|
160
|
+
([PR 480])(https://github.com/squaremo/amqp.node/pull/480)
|
|
161
|
+
* Test on node 11.1
|
|
162
|
+
([PR 473])(https://github.com/squaremo/amqp.node/pull/464); thanks
|
|
163
|
+
@kibertoad
|
|
164
|
+
* Updated various dependencies
|
|
165
|
+
* Support queue mode during assertQueue
|
|
166
|
+
([PR 464])(https://github.com/squaremo/amqp.node/pull/464); thanks
|
|
167
|
+
@JoeTheFkingFrypan
|
|
168
|
+
* Expose serverProperties in the connection object
|
|
169
|
+
([PR 452])(https://github.com/squaremo/amqp.node/pull/452); thanks
|
|
170
|
+
@jfromaniello
|
|
171
|
+
* Test on Node 10
|
|
172
|
+
([PR 454])(https://github.com/squaremo/amqp.node/pull/454); thanks
|
|
173
|
+
@kibertoad
|
|
174
|
+
* Support amqplain credentials
|
|
175
|
+
([PR 451])(https://github.com/squaremo/amqp.node/pull/451); thanks
|
|
176
|
+
@jfromaniello
|
|
177
|
+
* Decorate channel errors with methodId and classId
|
|
178
|
+
([PR 447])(https://github.com/squaremo/amqp.node/pull/447); thanks
|
|
179
|
+
@MitMaro
|
|
180
|
+
* Resolve issues caused by Node 10 `readable` changes
|
|
181
|
+
([PR 442])(https://github.com/squaremo/amqp.node/pull/442)
|
|
182
|
+
* Bump uglify to 2.6.x and node to 9.1 due to nodejs/node#16781.
|
|
183
|
+
([PR 439])(https://github.com/squaremo/amqp.node/pull/439)
|
|
184
|
+
* Updated README with more modern Buffer syntax
|
|
185
|
+
([PR 438](https://github.com/squaremo/amqp.node/pull/438); thanks
|
|
186
|
+
@ravshansbox
|
|
187
|
+
* Support overflow option to assert queue
|
|
188
|
+
([PR 436])(https://github.com/squaremo/amqp.node/pull/436); thanks
|
|
189
|
+
to @honestserpent
|
|
190
|
+
* Replace instances of keyword `await`
|
|
191
|
+
([PR 396])(https://github.com/squaremo/amqp.node/pull/396),
|
|
192
|
+
as discussed in
|
|
193
|
+
[issue 235](https://github.com/squaremo/amqp.node/issues/235)
|
|
194
|
+
* Use 3rd party url for better decoding of username/password
|
|
195
|
+
([PR 395])(https://github.com/squaremo/amqp.node/pull/395),
|
|
196
|
+
as discussed in
|
|
197
|
+
[issue 385](https://github.com/squaremo/amqp.node/issues/385))
|
|
198
|
+
|
|
199
|
+
## Changes in v0.5.2
|
|
200
|
+
|
|
201
|
+
git log v0.5.1..v0.5.2
|
|
202
|
+
|
|
203
|
+
* Increase encoding buffer to accommodate large header values
|
|
204
|
+
([PR 367](https://github.com/squaremo/amqp.node/pull/367))
|
|
205
|
+
* Bring code up to date with new Buffer interface
|
|
206
|
+
([PR 350](https://github.com/squaremo/amqp.node/pull/350))
|
|
207
|
+
* Fix dangling connection problem
|
|
208
|
+
([PR 340](https://github.com/squaremo/amqp.node/pull/340))
|
|
209
|
+
* Clear up URL credentials parsing
|
|
210
|
+
([PR 330](https://github.com/squaremo/amqp.node/pull/330))
|
|
211
|
+
* Allow connection params to be suppied in object
|
|
212
|
+
([PR 304](https://github.com/squaremo/amqp.node/pull/304))
|
|
213
|
+
* Support explicit numeric types in field tables (e.g., headers)
|
|
214
|
+
([PR 389](https://github.com/squaremo/amqp.node/pull/389), from a
|
|
215
|
+
suggestion in
|
|
216
|
+
[issue 358](https://github.com/squaremo/amqp.node/issues/358))
|
|
217
|
+
|
|
218
|
+
Thank you to all contributors, of PRs, issues and comments.
|
|
219
|
+
|
|
220
|
+
## Changes in v0.5.1
|
|
221
|
+
|
|
222
|
+
git log v0.5.0..v0.5.1
|
|
223
|
+
|
|
224
|
+
* Fix mistake in closeBecause
|
|
225
|
+
([PR 298](https://github.com/squaremo/amqp.node/pull/298); thanks
|
|
226
|
+
to @lholznagel and others who reported the issue, and to @nfantone
|
|
227
|
+
for the rapid fix)
|
|
228
|
+
|
|
229
|
+
## Changes in v0.5.0
|
|
230
|
+
|
|
231
|
+
git log v0.4.2..v0.5.0
|
|
232
|
+
|
|
233
|
+
* Port to use bluebird rather than when.js
|
|
234
|
+
([PR 295](https://github.com/squaremo/amqp.node/pull/295); thanks
|
|
235
|
+
to @nfantone, and special mention to @myndzi for #158)
|
|
236
|
+
* Fixed a problem with using `channel.get` in the callback model
|
|
237
|
+
([PR 283](https://github.com/squaremo/amqp.node/pull/283); good
|
|
238
|
+
catch, @shanksauce)
|
|
239
|
+
* Added an example that uses generators (thanks @rudijs)
|
|
240
|
+
* Fixed a link in the comments relating to heartbeats (thanks
|
|
241
|
+
@tapickell)
|
|
242
|
+
|
|
243
|
+
## Changes in v0.4.2
|
|
244
|
+
|
|
245
|
+
git log v0.4.1..v0.4.2
|
|
246
|
+
|
|
247
|
+
* Better documentation and examples
|
|
248
|
+
* Replace uses of ES6 keyword 'await'
|
|
249
|
+
|
|
250
|
+
## Changes in v0.4.1
|
|
251
|
+
|
|
252
|
+
git log v0.4.0..v0.4.1
|
|
253
|
+
|
|
254
|
+
* Tested in Node.JS 0.8 through 4.2 and 5.5
|
|
255
|
+
* Emit an error with the 'close' event if server-initiated
|
|
256
|
+
|
|
257
|
+
## Changes in v0.4.0
|
|
258
|
+
|
|
259
|
+
git log v0.3.2..v0.4.0
|
|
260
|
+
|
|
261
|
+
* Tested on Node.JS 0.8 through 4.0 (and intervening io.js releases)
|
|
262
|
+
* Change meaning of 'b' fields in tables to match RabbitMQ (and AMQP
|
|
263
|
+
specification)
|
|
264
|
+
* Can now pass an object in place of connection URL
|
|
265
|
+
([PR 159](https://github.com/squaremo/amqp.node/pull/159); thanks
|
|
266
|
+
to @ben-page)
|
|
267
|
+
* Operator-initiated connection close no longer results in 'error'
|
|
268
|
+
event
|
|
269
|
+
([issue 110](https://github.com/squaremo/amqp.node/issues/110))
|
|
270
|
+
* Channel and Connection errors have now a `.code` field with the
|
|
271
|
+
AMQP reply-code, which may help distinguish error cases
|
|
272
|
+
([PR 150](https://github.com/squaremo/amqp.node/pull/150); thanks
|
|
273
|
+
to @hippich)
|
|
274
|
+
* Connection.close will resolve to an error if the connection is
|
|
275
|
+
already closed
|
|
276
|
+
([issue 181](https://github.com/squaremo/amqp.node/issues/181))
|
|
277
|
+
* Connection establishment will resolve with an error if the
|
|
278
|
+
TCP-level connection or the handshake times out
|
|
279
|
+
([PR 169](https://github.com/squaremo/amqp.node/pull/169); thanks
|
|
280
|
+
to @zweifisch and @RoCat, who both submitted fixes)
|
|
281
|
+
* Add the `maxPriority` option as an alias for the `'x-max-priority'`
|
|
282
|
+
queue argument
|
|
283
|
+
([PR 180](https://github.com/squaremo/amqp.node/pull/180); thanks
|
|
284
|
+
to @ebardes)
|
|
285
|
+
|
|
286
|
+
## Changes in v0.3.2 (since v0.3.1)
|
|
287
|
+
|
|
288
|
+
git log v0.3.1..v0.3.2
|
|
289
|
+
|
|
290
|
+
* Make the engine specification more flexible to admit io.js releases
|
|
291
|
+
|
|
292
|
+
## Changes in v0.3.1 (since v0.3.0)
|
|
293
|
+
|
|
294
|
+
git log v0.3.0..v0.3.1
|
|
295
|
+
|
|
296
|
+
### Fixes
|
|
297
|
+
|
|
298
|
+
* Fail in the right way when a channel cannot be allocated [issue
|
|
299
|
+
129](https://github.com/squaremo/amqp.node/issues/129)
|
|
300
|
+
* Make `waitForConfirms` work properly in callback API [PR
|
|
301
|
+
116](https://github.com/squaremo/amqp.node/pull/116)
|
|
302
|
+
|
|
303
|
+
### Enhancements
|
|
304
|
+
|
|
305
|
+
* Two new options while connecting:
|
|
306
|
+
[timeout](https://github.com/squaremo/amqp.node/pull/118) and [keep
|
|
307
|
+
alive](https://github.com/squaremo/amqp.node/pull/125) (thanks to
|
|
308
|
+
@rexxars and @jcrugzz respectively)
|
|
309
|
+
|
|
310
|
+
## Changes in v0.3.0 (since v0.2.1)
|
|
311
|
+
|
|
312
|
+
git log v0.2.1..v0.3.0
|
|
313
|
+
|
|
314
|
+
### Enhancements
|
|
315
|
+
|
|
316
|
+
* Allow additional client properties to be set for a connection
|
|
317
|
+
[Issue 98](https://github.com/squaremo/amqp.node/issues/98) and
|
|
318
|
+
[PR 80](https://github.com/squaremo/amqp.node/pull/80)
|
|
319
|
+
* New method in channel API to wait for all unconfirmed messages
|
|
320
|
+
[Issue 89](https://github.com/squaremo/amqp.node/issues/89)
|
|
321
|
+
* Now supports RabbitMQ's `EXTERNAL` authentication plugin
|
|
322
|
+
[Issue 105](https://github.com/squaremo/amqp.node/issues/105)
|
|
323
|
+
|
|
324
|
+
## Changes in v0.2.1 (since v0.2.0)
|
|
325
|
+
|
|
326
|
+
### Fixes
|
|
327
|
+
|
|
328
|
+
* Do tuning negotation properly [PR
|
|
329
|
+
84](https://github.com/squaremo/amqp.node/pull/84)
|
|
330
|
+
|
|
331
|
+
## Changes in v0.2.0 (since v0.1.3)
|
|
332
|
+
|
|
333
|
+
git log v0.1.3..v0.2.0
|
|
334
|
+
|
|
335
|
+
### Fixes
|
|
336
|
+
|
|
337
|
+
* Correctly deal with missing fields (issue 48)
|
|
338
|
+
|
|
339
|
+
### Enhancements
|
|
340
|
+
|
|
341
|
+
* Added a callback-oriented API, parallel to the existing,
|
|
342
|
+
promise-oriented API.
|
|
343
|
+
* The response to assertExchange now contains the exchange name,
|
|
344
|
+
analagous to assertQueue (issue 49)
|
|
345
|
+
* The channel method `prefetch` now has a global flag, to be
|
|
346
|
+
[compatible with newer RabbitMQ][rabbitmq-prefetch-global].
|
|
347
|
+
|
|
348
|
+
## Changes in v0.1.3 (since v0.1.2)
|
|
349
|
+
|
|
350
|
+
git log v0.1.2..v0.1.3
|
|
351
|
+
|
|
352
|
+
### Enhancements
|
|
353
|
+
|
|
354
|
+
* Add support in the API for using Basic.Reject rather than
|
|
355
|
+
Basic.Nack, the latter of which is a RabbitMQ extension and not in
|
|
356
|
+
older versions of RabbitMQ.
|
|
357
|
+
|
|
358
|
+
## Changes in v0.1.2 (since v0.1.1)
|
|
359
|
+
|
|
360
|
+
git log v0.1.1..v0.1.2
|
|
361
|
+
|
|
362
|
+
### Fixes
|
|
363
|
+
|
|
364
|
+
* Restore support for publishing zero-length messages
|
|
365
|
+
|
|
366
|
+
### Enhancements
|
|
367
|
+
|
|
368
|
+
* Recognise [authentication failures][rabbitmq-auth-failure]
|
|
369
|
+
* An option to set TCP_NODELAY on connection sockets
|
|
370
|
+
|
|
371
|
+
## Changes in v0.1.1 (since v0.1.0)
|
|
372
|
+
|
|
373
|
+
git log v0.1.0..v0.1.1
|
|
374
|
+
|
|
375
|
+
### Fixes
|
|
376
|
+
|
|
377
|
+
* Safer frame construction, no longer relies on allocating a large,
|
|
378
|
+
fixed-size buffer and hoping it's big enough
|
|
379
|
+
* The ports of RabbitMQ tutorials now avoid a race between publishing
|
|
380
|
+
and closing the connection
|
|
381
|
+
|
|
382
|
+
### Enhancements
|
|
383
|
+
|
|
384
|
+
* Support for RabbitMQ's consumer priority extension
|
|
385
|
+
* Support for RabbitMQ's connnection.blocked extension
|
|
386
|
+
* Better write speed from batching frames for small messages
|
|
387
|
+
* Other minor efficiency gains in method encoding and decoding
|
|
388
|
+
* Channel and connection state errors (e.g., trying to write when
|
|
389
|
+
closed) include a stack trace from when they moved to that state
|
|
390
|
+
* The `arguments` table, passed as an option to some methods, can
|
|
391
|
+
include fields in its prototype chain
|
|
392
|
+
* Provide the more accurately named `persistent` as a near equivalent
|
|
393
|
+
of `deliveryMode`
|
|
394
|
+
|
|
395
|
+
## Changes in v0.1.0 (since v0.0.2)
|
|
396
|
+
|
|
397
|
+
git log v0.0.2..v0.1.0
|
|
398
|
+
|
|
399
|
+
### Breaking changes
|
|
400
|
+
|
|
401
|
+
* Consumer callbacks are invoked with `null` if the consumer is
|
|
402
|
+
cancelled (see
|
|
403
|
+
[RabbitMQ's consumer cancel notification][rabbitmq-consumer-cancel])
|
|
404
|
+
* In confirm channels, instead of `#publish` and `#sendToQueue`
|
|
405
|
+
returning promises, they return a boolean as for normal channels,
|
|
406
|
+
and take a Node.JS-style `function (err, ok)` callback for the
|
|
407
|
+
server ack or nack
|
|
408
|
+
|
|
409
|
+
### Fixes
|
|
410
|
+
|
|
411
|
+
* Overlapping channel and connection close frames are dealt with
|
|
412
|
+
gracefully
|
|
413
|
+
* Exceptions thrown in consumer callbacks are raised as `'error'`
|
|
414
|
+
events
|
|
415
|
+
* Zero-size messages are handled
|
|
416
|
+
* Avoid monkey-patching `Buffer`, and eschew
|
|
417
|
+
`require('util')._extend`
|
|
418
|
+
|
|
419
|
+
### Enhancements
|
|
420
|
+
|
|
421
|
+
* Channels now behave like `Writable` streams with regard to `#publish`
|
|
422
|
+
and `#sendToQueue`, returning a boolean from those methods and
|
|
423
|
+
emitting `'drain'`
|
|
424
|
+
* Connections now multiplex frames from channels fairly
|
|
425
|
+
* Low-level channel machinery is now fully callback-based
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
[rabbitmq-consumer-cancel]: http://www.rabbitmq.com/consumer-cancel.html
|
|
429
|
+
[rabbitmq-auth-failure]: http://www.rabbitmq.com/auth-notification.html
|
|
430
|
+
[rabbitmq-prefetch-global]: http://www.rabbitmq.com/consumer-prefetch.html
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013, 2014 Michael Bridgen <mikeb@squaremobius.net>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
RABBITMQ_SRC_VERSION=rabbitmq_v3_2_1
|
|
2
|
+
JSON=amqp-rabbitmq-0.9.1.json
|
|
3
|
+
RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen
|
|
4
|
+
AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON)
|
|
5
|
+
|
|
6
|
+
NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0'
|
|
7
|
+
|
|
8
|
+
MOCHA=./node_modules/.bin/mocha
|
|
9
|
+
_MOCHA=./node_modules/.bin/_mocha
|
|
10
|
+
UGLIFY=./node_modules/.bin/uglifyjs
|
|
11
|
+
NYC=./node_modules/.bin/nyc
|
|
12
|
+
|
|
13
|
+
.PHONY: test test-all-nodejs all clean coverage
|
|
14
|
+
|
|
15
|
+
all: lib/defs.js
|
|
16
|
+
|
|
17
|
+
clean:
|
|
18
|
+
rm lib/defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
19
|
+
rm -rf ./coverage
|
|
20
|
+
|
|
21
|
+
lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
22
|
+
(cd bin; node ./generate-defs.js > ../lib/defs.js)
|
|
23
|
+
$(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
|
|
24
|
+
-c 'sequences=false' --comments \
|
|
25
|
+
-b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
|
|
26
|
+
|
|
27
|
+
test: lib/defs.js
|
|
28
|
+
$(MOCHA) --check-leaks -u tdd --exit test/
|
|
29
|
+
|
|
30
|
+
test-all-nodejs: lib/defs.js
|
|
31
|
+
for v in $(NODEJS_VERSIONS); \
|
|
32
|
+
do echo "-- Node version $$v --"; \
|
|
33
|
+
nave use $$v $(MOCHA) -u tdd --exit -R progress test; \
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
coverage: $(NYC) lib/defs.js
|
|
37
|
+
$(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/
|
|
38
|
+
@echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html"
|
|
39
|
+
|
|
40
|
+
bin/amqp-rabbitmq-0.9.1.json:
|
|
41
|
+
curl -L $(AMQP_JSON) > $@
|
|
42
|
+
|
|
43
|
+
$(ISTANBUL):
|
|
44
|
+
npm install
|
|
45
|
+
|
|
46
|
+
$(UGLIFY):
|
|
47
|
+
npm install
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# AMQP 0-9-1 library and client for Node.JS
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/amqplib)
|
|
4
|
+
[](https://www.npmjs.com/package/amqplib)
|
|
5
|
+
[](https://github.com/amqp-node/amqplib/actions?query=workflow%3A%22Node.js+CI%22)
|
|
6
|
+
[](https://snyk.io/advisor/npm-package/amqplib)
|
|
7
|
+
|
|
8
|
+
npm install amqplib
|
|
9
|
+
|
|
10
|
+
* [Change log][changelog]
|
|
11
|
+
* [GitHub pages][gh-pages]
|
|
12
|
+
* [API reference][gh-pages-apiref]
|
|
13
|
+
* [Troubleshooting][gh-pages-trouble]
|
|
14
|
+
* [Examples from RabbitMQ tutorials][tutes]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+.
|
|
18
|
+
|
|
19
|
+
This library does not implement [AMQP
|
|
20
|
+
1.0](https://github.com/squaremo/amqp.node/issues/63) or [AMQP
|
|
21
|
+
0-10](https://github.com/squaremo/amqp.node/issues/94).
|
|
22
|
+
|
|
23
|
+
Project status:
|
|
24
|
+
|
|
25
|
+
- Expected to work
|
|
26
|
+
- Complete high-level and low-level APIs (i.e., all bits of the protocol)
|
|
27
|
+
- Stable APIs
|
|
28
|
+
- A fair few tests
|
|
29
|
+
- Measured test coverage
|
|
30
|
+
- Ports of the [RabbitMQ tutorials][rabbitmq-tutes] as [examples][tutes]
|
|
31
|
+
- Used in production
|
|
32
|
+
|
|
33
|
+
Still working on:
|
|
34
|
+
|
|
35
|
+
- Getting to 100% (or very close to 100%) test coverage
|
|
36
|
+
|
|
37
|
+
## Callback API example
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
const amqplib = require('amqplib/callback_api');
|
|
41
|
+
const queue = 'tasks';
|
|
42
|
+
|
|
43
|
+
amqplib.connect('amqp://localhost', (err, conn) => {
|
|
44
|
+
if (err) throw err;
|
|
45
|
+
|
|
46
|
+
// Listener
|
|
47
|
+
conn.createChannel((err, ch2) => {
|
|
48
|
+
if (err) throw err;
|
|
49
|
+
|
|
50
|
+
ch2.assertQueue(queue);
|
|
51
|
+
|
|
52
|
+
ch2.consume(queue, (msg) => {
|
|
53
|
+
if (msg !== null) {
|
|
54
|
+
console.log(msg.content.toString());
|
|
55
|
+
ch2.ack(msg);
|
|
56
|
+
} else {
|
|
57
|
+
console.log('Consumer cancelled by server');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Sender
|
|
63
|
+
conn.createChannel((err, ch1) => {
|
|
64
|
+
if (err) throw err;
|
|
65
|
+
|
|
66
|
+
ch1.assertQueue(queue);
|
|
67
|
+
|
|
68
|
+
setInterval(() => {
|
|
69
|
+
ch1.sendToQueue(queue, Buffer.from('something to do'));
|
|
70
|
+
}, 1000);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Promise/Async API example
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
const amqplib = require('amqplib');
|
|
79
|
+
|
|
80
|
+
(async () => {
|
|
81
|
+
const queue = 'tasks';
|
|
82
|
+
const conn = await amqplib.connect('amqp://localhost');
|
|
83
|
+
|
|
84
|
+
const ch1 = await conn.createChannel();
|
|
85
|
+
await ch1.assertQueue(queue);
|
|
86
|
+
|
|
87
|
+
// Listener
|
|
88
|
+
ch1.consume(queue, (msg) => {
|
|
89
|
+
if (msg !== null) {
|
|
90
|
+
console.log('Recieved:', msg.content.toString());
|
|
91
|
+
ch1.ack(msg);
|
|
92
|
+
} else {
|
|
93
|
+
console.log('Consumer cancelled by server');
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Sender
|
|
98
|
+
const ch2 = await conn.createChannel();
|
|
99
|
+
|
|
100
|
+
setInterval(() => {
|
|
101
|
+
ch2.sendToQueue(queue, Buffer.from('something to do'));
|
|
102
|
+
}, 1000);
|
|
103
|
+
})();
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Running tests
|
|
108
|
+
|
|
109
|
+
npm test
|
|
110
|
+
|
|
111
|
+
To run the tests RabbitMQ is required. Either install it with your package
|
|
112
|
+
manager, or use [docker][] to run a RabbitMQ instance.
|
|
113
|
+
|
|
114
|
+
docker run -d --name amqp.test -p 5672:5672 rabbitmq
|
|
115
|
+
|
|
116
|
+
If prefer not to run RabbitMQ locally it is also possible to use a
|
|
117
|
+
instance of RabbitMQ hosted elsewhere. Use the `URL` environment
|
|
118
|
+
variable to configure a different amqp host to connect to. You may
|
|
119
|
+
also need to do this if docker is not on localhost; e.g., if it's
|
|
120
|
+
running in docker-machine.
|
|
121
|
+
|
|
122
|
+
One public host is dev.rabbitmq.com:
|
|
123
|
+
|
|
124
|
+
URL=amqp://dev.rabbitmq.com npm test
|
|
125
|
+
|
|
126
|
+
**NB** You may experience test failures due to timeouts if using the
|
|
127
|
+
dev.rabbitmq.com instance.
|
|
128
|
+
|
|
129
|
+
You can run it under different versions of Node.JS using [nave][]:
|
|
130
|
+
|
|
131
|
+
nave use 10 npm test
|
|
132
|
+
|
|
133
|
+
or run the tests on all supported versions of Node.JS in one go:
|
|
134
|
+
|
|
135
|
+
make test-all-nodejs
|
|
136
|
+
|
|
137
|
+
(which also needs `nave` installed, of course).
|
|
138
|
+
|
|
139
|
+
Lastly, setting the environment variable `LOG_ERRORS` will cause the
|
|
140
|
+
tests to output error messages encountered, to the console; this is
|
|
141
|
+
really only useful for checking the kind and formatting of the errors.
|
|
142
|
+
|
|
143
|
+
LOG_ERRORS=true npm test
|
|
144
|
+
|
|
145
|
+
## Test coverage
|
|
146
|
+
|
|
147
|
+
make coverage
|
|
148
|
+
open file://`pwd`/coverage/lcov-report/index.html
|
|
149
|
+
|
|
150
|
+
[gh-pages]: https://amqp-node.github.io/amqplib/
|
|
151
|
+
[gh-pages-apiref]: https://amqp-node.github.io/amqplib/channel_api.html
|
|
152
|
+
[gh-pages-trouble]: https://amqp-node.github.io/amqplib/#troubleshooting
|
|
153
|
+
[nave]: https://github.com/isaacs/nave
|
|
154
|
+
[tutes]: https://github.com/amqp-node/amqplib/tree/main/examples/tutorials
|
|
155
|
+
[rabbitmq-tutes]: http://www.rabbitmq.com/getstarted.html
|
|
156
|
+
[changelog]: https://github.com/amqp-node/amqplib/blob/main/CHANGELOG.md
|
|
157
|
+
[docker]: https://www.docker.com/
|