amqplib 0.10.4 → 0.10.6
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/.github/workflows/publish.yml +59 -0
- package/CHANGELOG.md +12 -0
- package/Makefile +19 -16
- package/README.md +2 -3
- package/bin/amqp-rabbitmq-0.9.1.json +483 -0
- package/bin/generate-defs.js +1 -1
- package/lib/callback_model.js +12 -2
- package/lib/channel.js +5 -1
- package/lib/channel_model.js +4 -2
- package/lib/codec.js +24 -0
- package/lib/connect.js +2 -2
- package/lib/connection.js +2 -5
- package/package.json +3 -5
- package/test/callback_api.js +61 -2
- package/test/codec.js +11 -11
- package/test/data.js +15 -0
- package/test/frame.js +1 -2
- package/test/mux.js +1 -2
- package/test/util.js +1 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
services:
|
|
11
|
+
rabbitmq:
|
|
12
|
+
image: rabbitmq:3-alpine
|
|
13
|
+
ports:
|
|
14
|
+
- 5672:5672
|
|
15
|
+
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
|
|
19
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v3
|
|
23
|
+
|
|
24
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
cache: "npm"
|
|
29
|
+
|
|
30
|
+
- run: npm ci
|
|
31
|
+
|
|
32
|
+
- run: |
|
|
33
|
+
n=0
|
|
34
|
+
while :
|
|
35
|
+
do
|
|
36
|
+
sleep 5
|
|
37
|
+
echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
|
|
38
|
+
[[ $? = 0 ]] && break || ((n++))
|
|
39
|
+
(( n >= 5 )) && break
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
- run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
|
|
43
|
+
|
|
44
|
+
- run: make test
|
|
45
|
+
|
|
46
|
+
publish:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v3
|
|
51
|
+
- uses: actions/setup-node@v3
|
|
52
|
+
with:
|
|
53
|
+
node-version: '20.x'
|
|
54
|
+
cache: "npm"
|
|
55
|
+
registry-url: https://registry.npmjs.org/
|
|
56
|
+
- run: npm ci
|
|
57
|
+
- run: npm publish --dry-run
|
|
58
|
+
env:
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change log for amqplib
|
|
2
2
|
|
|
3
|
+
## v0.10.6
|
|
4
|
+
- Replace references to the old squaremo/amqp.name repo with ones to amqp-node/amqplib
|
|
5
|
+
- Use a frame_max of 131072 by default for RabbitMQ 4.1.0 compatibility
|
|
6
|
+
|
|
7
|
+
## Changes in v0.10.5
|
|
8
|
+
|
|
9
|
+
git log v0.10.4..v0.10.5
|
|
10
|
+
|
|
11
|
+
- Removed readable stream - See https://github.com/amqp-node/amqplib/issues/729
|
|
12
|
+
- Added support for unsigned integers - See https://github.com/amqp-node/amqplib/pull/773
|
|
13
|
+
- Committed protocol definitions - See https://github.com/amqp-node/amqplib/commit/0a87ee480311633cff41e43350a90cb3c1221506
|
|
14
|
+
|
|
3
15
|
## Changes in v0.10.4
|
|
4
16
|
|
|
5
17
|
- Improve stream example as per https://github.com/amqp-node/amqplib/issues/722
|
package/Makefile
CHANGED
|
@@ -9,33 +9,36 @@ _MOCHA=./node_modules/.bin/_mocha
|
|
|
9
9
|
UGLIFY=./node_modules/.bin/uglifyjs
|
|
10
10
|
NYC=./node_modules/.bin/nyc
|
|
11
11
|
|
|
12
|
-
.PHONY: test test-all-nodejs
|
|
12
|
+
.PHONY: test test-all-nodejs coverage lib/defs.js
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
error:
|
|
15
|
+
@echo "Please choose one of the following targets: test, test-all-nodejs, coverage, lib/defs.js"
|
|
16
|
+
@exit 1
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
rm lib/defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
18
|
-
rm -rf ./coverage
|
|
19
|
-
|
|
20
|
-
lib/defs.js: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
21
|
-
(cd bin; node ./generate-defs.js > ../lib/defs.js)
|
|
22
|
-
$(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
|
|
23
|
-
-c 'sequences=false' --comments \
|
|
24
|
-
-b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
|
|
25
|
-
|
|
26
|
-
test: lib/defs.js
|
|
18
|
+
test:
|
|
27
19
|
$(MOCHA) --check-leaks -u tdd --exit test/
|
|
28
20
|
|
|
29
|
-
test-all-nodejs:
|
|
21
|
+
test-all-nodejs:
|
|
30
22
|
for v in $(NODEJS_VERSIONS); \
|
|
31
23
|
do echo "-- Node version $$v --"; \
|
|
32
24
|
nave use $$v $(MOCHA) -u tdd --exit -R progress test; \
|
|
33
25
|
done
|
|
34
26
|
|
|
35
|
-
coverage: $(NYC)
|
|
36
|
-
$(NYC) --reporter=lcov --reporter=text $(_MOCHA) -u tdd -R progress test/
|
|
27
|
+
coverage: $(NYC)
|
|
28
|
+
$(NYC) --clean --reporter=lcov --reporter=text $(_MOCHA) -u tdd --exit -R progress test/
|
|
37
29
|
@echo "HTML report at file://$$(pwd)/coverage/lcov-report/index.html"
|
|
38
30
|
|
|
31
|
+
lib/defs.js: clean bin/generate-defs test
|
|
32
|
+
|
|
33
|
+
clean:
|
|
34
|
+
rm -f lib/defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
35
|
+
|
|
36
|
+
bin/generate-defs: $(UGLIFY) bin/generate-defs.js bin/amqp-rabbitmq-0.9.1.json
|
|
37
|
+
(cd bin; node ./generate-defs.js > ../lib/defs.js)
|
|
38
|
+
$(UGLIFY) ./lib/defs.js -o ./lib/defs.js \
|
|
39
|
+
-c 'sequences=false' --comments \
|
|
40
|
+
-b 'indent-level=2' 2>&1 | (grep -v 'WARN' || true)
|
|
41
|
+
|
|
39
42
|
bin/amqp-rabbitmq-0.9.1.json:
|
|
40
43
|
curl -L $(AMQP_JSON) > $@
|
|
41
44
|
|
package/README.md
CHANGED
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
* [Troubleshooting][gh-pages-trouble]
|
|
14
14
|
* [Examples from RabbitMQ tutorials][tutes]
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+.
|
|
18
17
|
|
|
19
18
|
This library does not implement [AMQP
|
|
20
|
-
1.0](https://github.com/
|
|
21
|
-
0-10](https://github.com/
|
|
19
|
+
1.0](https://github.com/amqp-node/amqplib/issues/63) or [AMQP
|
|
20
|
+
0-10](https://github.com/amqp-node/amqplib/issues/94).
|
|
22
21
|
|
|
23
22
|
Project status:
|
|
24
23
|
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AMQP",
|
|
3
|
+
"major-version": 0,
|
|
4
|
+
"minor-version": 9,
|
|
5
|
+
"revision": 1,
|
|
6
|
+
"port": 5672,
|
|
7
|
+
"copyright": [
|
|
8
|
+
"Copyright (C) 2008-2020 VMware, Inc. or its affiliates.\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"Permission is hereby granted, free of charge, to any person\n",
|
|
11
|
+
"obtaining a copy of this file (the \"Software\"), to deal in the\n",
|
|
12
|
+
"Software without restriction, including without limitation the \n",
|
|
13
|
+
"rights to use, copy, modify, merge, publish, distribute, \n",
|
|
14
|
+
"sublicense, and/or sell copies of the Software, and to permit \n",
|
|
15
|
+
"persons to whom the Software is furnished to do so, subject to \n",
|
|
16
|
+
"the following conditions:\n",
|
|
17
|
+
"\n",
|
|
18
|
+
"The above copyright notice and this permission notice shall be\n",
|
|
19
|
+
"included in all copies or substantial portions of the Software.\n",
|
|
20
|
+
"\n",
|
|
21
|
+
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n",
|
|
22
|
+
"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n",
|
|
23
|
+
"OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n",
|
|
24
|
+
"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n",
|
|
25
|
+
"HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n",
|
|
26
|
+
"WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n",
|
|
27
|
+
"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n",
|
|
28
|
+
"OTHER DEALINGS IN THE SOFTWARE.\n",
|
|
29
|
+
"\n",
|
|
30
|
+
"Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf\n",
|
|
31
|
+
"Updated for 0-9-1 by Tony Garnock-Jones\n",
|
|
32
|
+
"\n",
|
|
33
|
+
"b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf\n",
|
|
34
|
+
"http://twiststandards.org/?option=com_docman&task=cat_view&gid=28&Itemid=90\n",
|
|
35
|
+
"8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf\n",
|
|
36
|
+
"https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1\n"],
|
|
37
|
+
|
|
38
|
+
"domains": [
|
|
39
|
+
["bit", "bit"],
|
|
40
|
+
["channel-id", "longstr"],
|
|
41
|
+
["class-id", "short"],
|
|
42
|
+
["consumer-tag", "shortstr"],
|
|
43
|
+
["delivery-tag", "longlong"],
|
|
44
|
+
["destination", "shortstr"],
|
|
45
|
+
["duration", "longlong"],
|
|
46
|
+
["exchange-name", "shortstr"],
|
|
47
|
+
["long", "long"],
|
|
48
|
+
["longlong", "longlong"],
|
|
49
|
+
["longstr", "longstr"],
|
|
50
|
+
["message-count", "long"],
|
|
51
|
+
["method-id", "short"],
|
|
52
|
+
["no-ack", "bit"],
|
|
53
|
+
["no-local", "bit"],
|
|
54
|
+
["octet", "octet"],
|
|
55
|
+
["offset", "longlong"],
|
|
56
|
+
["path", "shortstr"],
|
|
57
|
+
["peer-properties", "table"],
|
|
58
|
+
["queue-name", "shortstr"],
|
|
59
|
+
["redelivered", "bit"],
|
|
60
|
+
["reference", "longstr"],
|
|
61
|
+
["reject-code", "short"],
|
|
62
|
+
["reject-text", "shortstr"],
|
|
63
|
+
["reply-code", "short"],
|
|
64
|
+
["reply-text", "shortstr"],
|
|
65
|
+
["security-token", "longstr"],
|
|
66
|
+
["short", "short"],
|
|
67
|
+
["shortstr", "shortstr"],
|
|
68
|
+
["table", "table"],
|
|
69
|
+
["timestamp", "timestamp"]
|
|
70
|
+
],
|
|
71
|
+
|
|
72
|
+
"constants": [
|
|
73
|
+
{"name": "FRAME-METHOD", "value": 1},
|
|
74
|
+
{"name": "FRAME-HEADER", "value": 2},
|
|
75
|
+
{"name": "FRAME-BODY", "value": 3},
|
|
76
|
+
{"name": "FRAME-HEARTBEAT", "value": 8},
|
|
77
|
+
{"name": "FRAME-MIN-SIZE", "value": 4096},
|
|
78
|
+
{"name": "FRAME-END", "value": 206},
|
|
79
|
+
{"name": "REPLY-SUCCESS", "value": 200},
|
|
80
|
+
{"name": "CONTENT-TOO-LARGE", "value": 311, "class": "soft-error"},
|
|
81
|
+
{"name": "NO-ROUTE", "value": 312, "class": "soft-error"},
|
|
82
|
+
{"name": "NO-CONSUMERS", "value": 313, "class": "soft-error"},
|
|
83
|
+
{"name": "ACCESS-REFUSED", "value": 403, "class": "soft-error"},
|
|
84
|
+
{"name": "NOT-FOUND", "value": 404, "class": "soft-error"},
|
|
85
|
+
{"name": "RESOURCE-LOCKED", "value": 405, "class": "soft-error"},
|
|
86
|
+
{"name": "PRECONDITION-FAILED", "value": 406, "class": "soft-error"},
|
|
87
|
+
{"name": "CONNECTION-FORCED", "value": 320, "class": "hard-error"},
|
|
88
|
+
{"name": "INVALID-PATH", "value": 402, "class": "hard-error"},
|
|
89
|
+
{"name": "FRAME-ERROR", "value": 501, "class": "hard-error"},
|
|
90
|
+
{"name": "SYNTAX-ERROR", "value": 502, "class": "hard-error"},
|
|
91
|
+
{"name": "COMMAND-INVALID", "value": 503, "class": "hard-error"},
|
|
92
|
+
{"name": "CHANNEL-ERROR", "value": 504, "class": "hard-error"},
|
|
93
|
+
{"name": "UNEXPECTED-FRAME", "value": 505, "class": "hard-error"},
|
|
94
|
+
{"name": "RESOURCE-ERROR", "value": 506, "class": "hard-error"},
|
|
95
|
+
{"name": "NOT-ALLOWED", "value": 530, "class": "hard-error"},
|
|
96
|
+
{"name": "NOT-IMPLEMENTED", "value": 540, "class": "hard-error"},
|
|
97
|
+
{"name": "INTERNAL-ERROR", "value": 541, "class": "hard-error"}
|
|
98
|
+
],
|
|
99
|
+
|
|
100
|
+
"classes": [
|
|
101
|
+
{
|
|
102
|
+
"id": 60,
|
|
103
|
+
"methods": [{"id": 10,
|
|
104
|
+
"arguments": [{"type": "long", "name": "prefetch-size", "default-value": 0},
|
|
105
|
+
{"type": "short", "name": "prefetch-count", "default-value": 0},
|
|
106
|
+
{"type": "bit", "name": "global", "default-value": false}],
|
|
107
|
+
"name": "qos",
|
|
108
|
+
"synchronous" : true},
|
|
109
|
+
{"id": 11,
|
|
110
|
+
"arguments": [],
|
|
111
|
+
"name": "qos-ok"},
|
|
112
|
+
{"id": 20,
|
|
113
|
+
"arguments": [{"domain": "short", "name": "ticket", "default-value": 0},
|
|
114
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
115
|
+
{"type": "shortstr", "name": "consumer-tag", "default-value": ""},
|
|
116
|
+
{"type": "bit", "name": "no-local", "default-value": false},
|
|
117
|
+
{"type": "bit", "name": "no-ack", "default-value": false},
|
|
118
|
+
{"type": "bit", "name": "exclusive", "default-value": false},
|
|
119
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
120
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
121
|
+
"name": "consume",
|
|
122
|
+
"synchronous" : true},
|
|
123
|
+
{"id": 21,
|
|
124
|
+
"arguments": [{"type": "shortstr", "name": "consumer-tag"}],
|
|
125
|
+
"name": "consume-ok"},
|
|
126
|
+
{"id": 30,
|
|
127
|
+
"arguments": [{"type": "shortstr", "name": "consumer-tag"},
|
|
128
|
+
{"type": "bit", "name": "nowait", "default-value": false}],
|
|
129
|
+
"name": "cancel",
|
|
130
|
+
"synchronous" : true},
|
|
131
|
+
{"id": 31,
|
|
132
|
+
"arguments": [{"type": "shortstr", "name": "consumer-tag"}],
|
|
133
|
+
"name": "cancel-ok"},
|
|
134
|
+
{"content": true,
|
|
135
|
+
"id": 40,
|
|
136
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
137
|
+
{"domain": "exchange-name", "name": "exchange", "default-value": ""},
|
|
138
|
+
{"type": "shortstr", "name": "routing-key", "default-value": ""},
|
|
139
|
+
{"type": "bit", "name": "mandatory", "default-value": false},
|
|
140
|
+
{"type": "bit", "name": "immediate", "default-value": false}],
|
|
141
|
+
"name": "publish"},
|
|
142
|
+
{"content": true,
|
|
143
|
+
"id": 50,
|
|
144
|
+
"arguments": [{"type": "short", "name": "reply-code"},
|
|
145
|
+
{"type": "shortstr", "name": "reply-text", "default-value": ""},
|
|
146
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
147
|
+
{"type": "shortstr", "name": "routing-key"}],
|
|
148
|
+
"name": "return"},
|
|
149
|
+
{"content": true,
|
|
150
|
+
"id": 60,
|
|
151
|
+
"arguments": [{"type": "shortstr", "name": "consumer-tag"},
|
|
152
|
+
{"type": "longlong", "name": "delivery-tag"},
|
|
153
|
+
{"type": "bit", "name": "redelivered", "default-value": false},
|
|
154
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
155
|
+
{"type": "shortstr", "name": "routing-key"}],
|
|
156
|
+
"name": "deliver"},
|
|
157
|
+
{"id": 70,
|
|
158
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
159
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
160
|
+
{"type": "bit", "name": "no-ack", "default-value": false}],
|
|
161
|
+
"name": "get",
|
|
162
|
+
"synchronous" : true},
|
|
163
|
+
{"content": true,
|
|
164
|
+
"id": 71,
|
|
165
|
+
"arguments": [{"type": "longlong", "name": "delivery-tag"},
|
|
166
|
+
{"type": "bit", "name": "redelivered", "default-value": false},
|
|
167
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
168
|
+
{"type": "shortstr", "name": "routing-key"},
|
|
169
|
+
{"domain": "message-count", "name": "message-count"}],
|
|
170
|
+
"name": "get-ok"},
|
|
171
|
+
{"id": 72,
|
|
172
|
+
"arguments": [{"type": "shortstr", "name": "cluster-id", "default-value": ""}],
|
|
173
|
+
"name": "get-empty"},
|
|
174
|
+
{"id": 80,
|
|
175
|
+
"arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0},
|
|
176
|
+
{"type": "bit", "name": "multiple", "default-value": false}],
|
|
177
|
+
"name": "ack"},
|
|
178
|
+
{"id": 90,
|
|
179
|
+
"arguments": [{"type": "longlong", "name": "delivery-tag"},
|
|
180
|
+
{"type": "bit", "name": "requeue", "default-value": true}],
|
|
181
|
+
"name": "reject"},
|
|
182
|
+
{"id": 100,
|
|
183
|
+
"arguments": [{"type": "bit", "name": "requeue", "default-value": false}],
|
|
184
|
+
"name": "recover-async"},
|
|
185
|
+
{"id": 110,
|
|
186
|
+
"arguments": [{"type": "bit", "name": "requeue", "default-value": false}],
|
|
187
|
+
"name": "recover",
|
|
188
|
+
"synchronous" : true},
|
|
189
|
+
{"id": 111,
|
|
190
|
+
"arguments": [],
|
|
191
|
+
"name": "recover-ok"},
|
|
192
|
+
{"id": 120,
|
|
193
|
+
"arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0},
|
|
194
|
+
{"type": "bit", "name": "multiple", "default-value": false},
|
|
195
|
+
{"type": "bit", "name": "requeue", "default-value": true}],
|
|
196
|
+
"name": "nack"}],
|
|
197
|
+
"name": "basic",
|
|
198
|
+
"properties": [{"type": "shortstr", "name": "content-type"},
|
|
199
|
+
{"type": "shortstr", "name": "content-encoding"},
|
|
200
|
+
{"type": "table", "name": "headers"},
|
|
201
|
+
{"type": "octet", "name": "delivery-mode"},
|
|
202
|
+
{"type": "octet", "name": "priority"},
|
|
203
|
+
{"type": "shortstr", "name": "correlation-id"},
|
|
204
|
+
{"type": "shortstr", "name": "reply-to"},
|
|
205
|
+
{"type": "shortstr", "name": "expiration"},
|
|
206
|
+
{"type": "shortstr", "name": "message-id"},
|
|
207
|
+
{"type": "timestamp", "name": "timestamp"},
|
|
208
|
+
{"type": "shortstr", "name": "type"},
|
|
209
|
+
{"type": "shortstr", "name": "user-id"},
|
|
210
|
+
{"type": "shortstr", "name": "app-id"},
|
|
211
|
+
{"type": "shortstr", "name": "cluster-id"}]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": 10,
|
|
215
|
+
"methods": [{"id": 10,
|
|
216
|
+
"arguments": [{"type": "octet", "name": "version-major", "default-value": 0},
|
|
217
|
+
{"type": "octet", "name": "version-minor", "default-value": 9},
|
|
218
|
+
{"domain": "peer-properties", "name": "server-properties"},
|
|
219
|
+
{"type": "longstr", "name": "mechanisms", "default-value": "PLAIN"},
|
|
220
|
+
{"type": "longstr", "name": "locales", "default-value": "en_US"}],
|
|
221
|
+
"name": "start",
|
|
222
|
+
"synchronous" : true},
|
|
223
|
+
{"id": 11,
|
|
224
|
+
"arguments": [{"domain": "peer-properties", "name": "client-properties"},
|
|
225
|
+
{"type": "shortstr", "name": "mechanism", "default-value": "PLAIN"},
|
|
226
|
+
{"type": "longstr", "name": "response"},
|
|
227
|
+
{"type": "shortstr", "name": "locale", "default-value": "en_US"}],
|
|
228
|
+
"name": "start-ok"},
|
|
229
|
+
{"id": 20,
|
|
230
|
+
"arguments": [{"type": "longstr", "name": "challenge"}],
|
|
231
|
+
"name": "secure",
|
|
232
|
+
"synchronous" : true},
|
|
233
|
+
{"id": 21,
|
|
234
|
+
"arguments": [{"type": "longstr", "name": "response"}],
|
|
235
|
+
"name": "secure-ok"},
|
|
236
|
+
{"id": 30,
|
|
237
|
+
"arguments": [{"type": "short", "name": "channel-max", "default-value": 0},
|
|
238
|
+
{"type": "long", "name": "frame-max", "default-value": 0},
|
|
239
|
+
{"type": "short", "name": "heartbeat", "default-value": 0}],
|
|
240
|
+
"name": "tune",
|
|
241
|
+
"synchronous" : true},
|
|
242
|
+
{"id": 31,
|
|
243
|
+
"arguments": [{"type": "short", "name": "channel-max", "default-value": 0},
|
|
244
|
+
{"type": "long", "name": "frame-max", "default-value": 0},
|
|
245
|
+
{"type": "short", "name": "heartbeat", "default-value": 0}],
|
|
246
|
+
"name": "tune-ok"},
|
|
247
|
+
{"id": 40,
|
|
248
|
+
"arguments": [{"type": "shortstr", "name": "virtual-host", "default-value": "/"},
|
|
249
|
+
{"type": "shortstr", "name": "capabilities", "default-value": ""},
|
|
250
|
+
{"type": "bit", "name": "insist", "default-value": false}],
|
|
251
|
+
"name": "open",
|
|
252
|
+
"synchronous" : true},
|
|
253
|
+
{"id": 41,
|
|
254
|
+
"arguments": [{"type": "shortstr", "name": "known-hosts", "default-value": ""}],
|
|
255
|
+
"name": "open-ok"},
|
|
256
|
+
{"id": 50,
|
|
257
|
+
"arguments": [{"type": "short", "name": "reply-code"},
|
|
258
|
+
{"type": "shortstr", "name": "reply-text", "default-value": ""},
|
|
259
|
+
{"type": "short", "name": "class-id"},
|
|
260
|
+
{"type": "short", "name": "method-id"}],
|
|
261
|
+
"name": "close",
|
|
262
|
+
"synchronous" : true},
|
|
263
|
+
{"id": 51,
|
|
264
|
+
"arguments": [],
|
|
265
|
+
"name": "close-ok"},
|
|
266
|
+
{"id": 60,
|
|
267
|
+
"arguments": [{"type": "shortstr", "name": "reason", "default-value": ""}],
|
|
268
|
+
"name": "blocked"},
|
|
269
|
+
{"id": 61,
|
|
270
|
+
"arguments": [],
|
|
271
|
+
"name": "unblocked"},
|
|
272
|
+
{"id": 70,
|
|
273
|
+
"arguments": [{"type": "longstr", "name": "new-secret"},
|
|
274
|
+
{"type": "shortstr", "name": "reason"}],
|
|
275
|
+
"name": "update-secret",
|
|
276
|
+
"synchronous" : true},
|
|
277
|
+
{"id": 71,
|
|
278
|
+
"arguments": [],
|
|
279
|
+
"name": "update-secret-ok"}
|
|
280
|
+
],
|
|
281
|
+
"name": "connection",
|
|
282
|
+
"properties": []
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"id": 20,
|
|
286
|
+
"methods": [{"id": 10,
|
|
287
|
+
"arguments": [{"type": "shortstr", "name": "out-of-band", "default-value": ""}],
|
|
288
|
+
"name": "open",
|
|
289
|
+
"synchronous" : true},
|
|
290
|
+
{"id": 11,
|
|
291
|
+
"arguments": [{"type": "longstr", "name": "channel-id", "default-value": ""}],
|
|
292
|
+
"name": "open-ok"},
|
|
293
|
+
{"id": 20,
|
|
294
|
+
"arguments": [{"type": "bit", "name": "active"}],
|
|
295
|
+
"name": "flow",
|
|
296
|
+
"synchronous" : true},
|
|
297
|
+
{"id": 21,
|
|
298
|
+
"arguments": [{"type": "bit", "name": "active"}],
|
|
299
|
+
"name": "flow-ok"},
|
|
300
|
+
{"id": 40,
|
|
301
|
+
"arguments": [{"type": "short", "name": "reply-code"},
|
|
302
|
+
{"type": "shortstr", "name": "reply-text", "default-value": ""},
|
|
303
|
+
{"type": "short", "name": "class-id"},
|
|
304
|
+
{"type": "short", "name": "method-id"}],
|
|
305
|
+
"name": "close",
|
|
306
|
+
"synchronous" : true},
|
|
307
|
+
{"id": 41,
|
|
308
|
+
"arguments": [],
|
|
309
|
+
"name": "close-ok"}],
|
|
310
|
+
"name": "channel"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"id": 30,
|
|
314
|
+
"methods": [{"id": 10,
|
|
315
|
+
"arguments": [{"type": "shortstr", "name": "realm", "default-value": "/data"},
|
|
316
|
+
{"type": "bit", "name": "exclusive", "default-value": false},
|
|
317
|
+
{"type": "bit", "name": "passive", "default-value": true},
|
|
318
|
+
{"type": "bit", "name": "active", "default-value": true},
|
|
319
|
+
{"type": "bit", "name": "write", "default-value": true},
|
|
320
|
+
{"type": "bit", "name": "read", "default-value": true}],
|
|
321
|
+
"name": "request",
|
|
322
|
+
"synchronous" : true},
|
|
323
|
+
{"id": 11,
|
|
324
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 1}],
|
|
325
|
+
"name": "request-ok"}],
|
|
326
|
+
"name": "access"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"id": 40,
|
|
330
|
+
"methods": [{"id": 10,
|
|
331
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
332
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
333
|
+
{"type": "shortstr", "name": "type", "default-value": "direct"},
|
|
334
|
+
{"type": "bit", "name": "passive", "default-value": false},
|
|
335
|
+
{"type": "bit", "name": "durable", "default-value": false},
|
|
336
|
+
{"type": "bit", "name": "auto-delete", "default-value": false},
|
|
337
|
+
{"type": "bit", "name": "internal", "default-value": false},
|
|
338
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
339
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
340
|
+
"name": "declare",
|
|
341
|
+
"synchronous" : true},
|
|
342
|
+
{"id": 11,
|
|
343
|
+
"arguments": [],
|
|
344
|
+
"name": "declare-ok"},
|
|
345
|
+
{"id": 20,
|
|
346
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
347
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
348
|
+
{"type": "bit", "name": "if-unused", "default-value": false},
|
|
349
|
+
{"type": "bit", "name": "nowait", "default-value": false}],
|
|
350
|
+
"name": "delete",
|
|
351
|
+
"synchronous" : true},
|
|
352
|
+
{"id": 21,
|
|
353
|
+
"arguments": [],
|
|
354
|
+
"name": "delete-ok"},
|
|
355
|
+
{"id": 30,
|
|
356
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
357
|
+
{"domain": "exchange-name", "name": "destination"},
|
|
358
|
+
{"domain": "exchange-name", "name": "source"},
|
|
359
|
+
{"type": "shortstr", "name": "routing-key", "default-value": ""},
|
|
360
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
361
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
362
|
+
"name": "bind",
|
|
363
|
+
"synchronous" : true},
|
|
364
|
+
{"id": 31,
|
|
365
|
+
"arguments": [],
|
|
366
|
+
"name": "bind-ok"},
|
|
367
|
+
{"id": 40,
|
|
368
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
369
|
+
{"domain": "exchange-name", "name": "destination"},
|
|
370
|
+
{"domain": "exchange-name", "name": "source"},
|
|
371
|
+
{"type": "shortstr", "name": "routing-key", "default-value": ""},
|
|
372
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
373
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
374
|
+
"name": "unbind",
|
|
375
|
+
"synchronous" : true},
|
|
376
|
+
{"id": 51,
|
|
377
|
+
"arguments": [],
|
|
378
|
+
"name": "unbind-ok"}],
|
|
379
|
+
"name": "exchange"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"id": 50,
|
|
383
|
+
"methods": [{"id": 10,
|
|
384
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
385
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
386
|
+
{"type": "bit", "name": "passive", "default-value": false},
|
|
387
|
+
{"type": "bit", "name": "durable", "default-value": false},
|
|
388
|
+
{"type": "bit", "name": "exclusive", "default-value": false},
|
|
389
|
+
{"type": "bit", "name": "auto-delete", "default-value": false},
|
|
390
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
391
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
392
|
+
"name": "declare",
|
|
393
|
+
"synchronous" : true},
|
|
394
|
+
{"id": 11,
|
|
395
|
+
"arguments": [{"domain": "queue-name", "name": "queue"},
|
|
396
|
+
{"domain": "message-count", "name": "message-count"},
|
|
397
|
+
{"type": "long", "name": "consumer-count"}],
|
|
398
|
+
"name": "declare-ok"},
|
|
399
|
+
{"id": 20,
|
|
400
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
401
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
402
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
403
|
+
{"type": "shortstr", "name": "routing-key", "default-value": ""},
|
|
404
|
+
{"type": "bit", "name": "nowait", "default-value": false},
|
|
405
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
406
|
+
"name": "bind",
|
|
407
|
+
"synchronous" : true},
|
|
408
|
+
{"id": 21,
|
|
409
|
+
"arguments": [],
|
|
410
|
+
"name": "bind-ok"},
|
|
411
|
+
{"id": 30,
|
|
412
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
413
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
414
|
+
{"type": "bit", "name": "nowait", "default-value": false}],
|
|
415
|
+
"name": "purge",
|
|
416
|
+
"synchronous" : true},
|
|
417
|
+
{"id": 31,
|
|
418
|
+
"arguments": [{"domain": "message-count", "name": "message-count"}],
|
|
419
|
+
"name": "purge-ok"},
|
|
420
|
+
{"id": 40,
|
|
421
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
422
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
423
|
+
{"type": "bit", "name": "if-unused", "default-value": false},
|
|
424
|
+
{"type": "bit", "name": "if-empty", "default-value": false},
|
|
425
|
+
{"type": "bit", "name": "nowait", "default-value": false}],
|
|
426
|
+
"name": "delete",
|
|
427
|
+
"synchronous" : true},
|
|
428
|
+
{"id": 41,
|
|
429
|
+
"arguments": [{"domain": "message-count", "name": "message-count"}],
|
|
430
|
+
"name": "delete-ok"},
|
|
431
|
+
{"id": 50,
|
|
432
|
+
"arguments": [{"type": "short", "name": "ticket", "default-value": 0},
|
|
433
|
+
{"domain": "queue-name", "name": "queue", "default-value": ""},
|
|
434
|
+
{"domain": "exchange-name", "name": "exchange"},
|
|
435
|
+
{"type": "shortstr", "name": "routing-key", "default-value": ""},
|
|
436
|
+
{"type": "table", "name": "arguments", "default-value": {}}],
|
|
437
|
+
"name": "unbind",
|
|
438
|
+
"synchronous" : true},
|
|
439
|
+
{"id": 51,
|
|
440
|
+
"arguments": [],
|
|
441
|
+
"name": "unbind-ok"}
|
|
442
|
+
],
|
|
443
|
+
"name": "queue"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"id": 90,
|
|
447
|
+
"methods": [{"id": 10,
|
|
448
|
+
"arguments": [],
|
|
449
|
+
"name": "select",
|
|
450
|
+
"synchronous" : true},
|
|
451
|
+
{"id": 11,
|
|
452
|
+
"arguments": [],
|
|
453
|
+
"name": "select-ok"},
|
|
454
|
+
{"id": 20,
|
|
455
|
+
"arguments": [],
|
|
456
|
+
"name": "commit",
|
|
457
|
+
"synchronous" : true},
|
|
458
|
+
{"id": 21,
|
|
459
|
+
"arguments": [],
|
|
460
|
+
"name": "commit-ok"},
|
|
461
|
+
{"id": 30,
|
|
462
|
+
"arguments": [],
|
|
463
|
+
"name": "rollback",
|
|
464
|
+
"synchronous" : true},
|
|
465
|
+
{"id": 31,
|
|
466
|
+
"arguments": [],
|
|
467
|
+
"name": "rollback-ok"}],
|
|
468
|
+
"name": "tx"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"id": 85,
|
|
472
|
+
"methods": [{"id": 10,
|
|
473
|
+
"arguments": [
|
|
474
|
+
{"type": "bit", "name": "nowait", "default-value": false}],
|
|
475
|
+
"name": "select",
|
|
476
|
+
"synchronous": true},
|
|
477
|
+
{"id": 11,
|
|
478
|
+
"arguments": [],
|
|
479
|
+
"name": "select-ok"}],
|
|
480
|
+
"name": "confirm"
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
}
|
package/bin/generate-defs.js
CHANGED
|
@@ -112,7 +112,7 @@ println(
|
|
|
112
112
|
'/** @preserve This file is generated by the script\n',
|
|
113
113
|
'* ../bin/generate-defs.js, which is not in general included in a\n',
|
|
114
114
|
'* distribution, but is available in the source repository e.g. at\n',
|
|
115
|
-
'* https://github.com/
|
|
115
|
+
'* https://github.com/amqp-node/amqplib/\n',
|
|
116
116
|
'*/');
|
|
117
117
|
|
|
118
118
|
println("'use strict';"); nl();
|
package/lib/callback_model.js
CHANGED
|
@@ -28,8 +28,13 @@ class CallbackModel extends EventEmitter {
|
|
|
28
28
|
this.connection._updateSecret(newSecret, reason, cb);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
createChannel (cb) {
|
|
31
|
+
createChannel (options, cb) {
|
|
32
|
+
if (arguments.length === 1) {
|
|
33
|
+
cb = options;
|
|
34
|
+
options = undefined;
|
|
35
|
+
}
|
|
32
36
|
var ch = new Channel(this.connection);
|
|
37
|
+
ch.setOptions(options);
|
|
33
38
|
ch.open(function (err, ok) {
|
|
34
39
|
if (err === null)
|
|
35
40
|
cb && cb(null, ch);
|
|
@@ -39,8 +44,13 @@ class CallbackModel extends EventEmitter {
|
|
|
39
44
|
return ch;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
createConfirmChannel (cb) {
|
|
47
|
+
createConfirmChannel (options, cb) {
|
|
48
|
+
if (arguments.length === 1) {
|
|
49
|
+
cb = options;
|
|
50
|
+
options = undefined;
|
|
51
|
+
}
|
|
43
52
|
var ch = new ConfirmChannel(this.connection);
|
|
53
|
+
ch.setOptions(options);
|
|
44
54
|
ch.open(function (err) {
|
|
45
55
|
if (err !== null)
|
|
46
56
|
return cb && cb(err);
|
package/lib/channel.js
CHANGED
|
@@ -47,8 +47,12 @@ class Channel extends EventEmitter {
|
|
|
47
47
|
this.handleMessage = acceptDeliveryOrReturn;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
setOptions(options) {
|
|
51
|
+
this.options = options;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
allocate () {
|
|
51
|
-
this.ch = this.connection.freshChannel(this);
|
|
55
|
+
this.ch = this.connection.freshChannel(this, this.options);
|
|
52
56
|
return this;
|
|
53
57
|
}
|
|
54
58
|
|
package/lib/channel_model.js
CHANGED
|
@@ -30,14 +30,16 @@ class ChannelModel extends EventEmitter {
|
|
|
30
30
|
return promisify(this.connection._updateSecret.bind(this.connection))(newSecret, reason);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
async createChannel() {
|
|
33
|
+
async createChannel(options) {
|
|
34
34
|
const channel = new Channel(this.connection);
|
|
35
|
+
channel.setOptions(options);
|
|
35
36
|
await channel.open();
|
|
36
37
|
return channel;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
async createConfirmChannel() {
|
|
40
|
+
async createConfirmChannel(options) {
|
|
40
41
|
const channel = new ConfirmChannel(this.connection);
|
|
42
|
+
channel.setOptions(options);
|
|
41
43
|
await channel.open();
|
|
42
44
|
await channel.rpc(defs.ConfirmSelect, {nowait: false}, defs.ConfirmSelectOk);
|
|
43
45
|
return channel;
|
package/lib/codec.js
CHANGED
|
@@ -188,16 +188,31 @@ function encodeFieldValue(buffer, value, offset) {
|
|
|
188
188
|
tag('b');
|
|
189
189
|
buffer.writeInt8(val, offset); offset++;
|
|
190
190
|
break;
|
|
191
|
+
case 'unsignedbyte':
|
|
192
|
+
case 'uint8':
|
|
193
|
+
tag('B');
|
|
194
|
+
buffer.writeUInt8(val, offset); offset++;
|
|
195
|
+
break;
|
|
191
196
|
case 'short':
|
|
192
197
|
case 'int16':
|
|
193
198
|
tag('s');
|
|
194
199
|
buffer.writeInt16BE(val, offset); offset += 2;
|
|
195
200
|
break;
|
|
201
|
+
case 'unsignedshort':
|
|
202
|
+
case 'uint16':
|
|
203
|
+
tag('u');
|
|
204
|
+
buffer.writeUInt16BE(val, offset); offset += 2;
|
|
205
|
+
break;
|
|
196
206
|
case 'int':
|
|
197
207
|
case 'int32':
|
|
198
208
|
tag('I');
|
|
199
209
|
buffer.writeInt32BE(val, offset); offset += 4;
|
|
200
210
|
break;
|
|
211
|
+
case 'unsignedint':
|
|
212
|
+
case 'uint32':
|
|
213
|
+
tag('i');
|
|
214
|
+
buffer.writeUInt32BE(val, offset); offset += 4;
|
|
215
|
+
break;
|
|
201
216
|
case 'long':
|
|
202
217
|
case 'int64':
|
|
203
218
|
tag('l');
|
|
@@ -243,6 +258,9 @@ function decodeFields(slice) {
|
|
|
243
258
|
case 'b':
|
|
244
259
|
val = slice.readInt8(offset); offset++;
|
|
245
260
|
break;
|
|
261
|
+
case 'B':
|
|
262
|
+
val = slice.readUInt8(offset); offset++;
|
|
263
|
+
break;
|
|
246
264
|
case 'S':
|
|
247
265
|
len = slice.readUInt32BE(offset); offset += 4;
|
|
248
266
|
val = slice.toString('utf8', offset, offset + len);
|
|
@@ -251,6 +269,9 @@ function decodeFields(slice) {
|
|
|
251
269
|
case 'I':
|
|
252
270
|
val = slice.readInt32BE(offset); offset += 4;
|
|
253
271
|
break;
|
|
272
|
+
case 'i':
|
|
273
|
+
val = slice.readUInt32BE(offset); offset += 4;
|
|
274
|
+
break;
|
|
254
275
|
case 'D': // only positive decimals, apparently.
|
|
255
276
|
var places = slice[offset]; offset++;
|
|
256
277
|
var digits = slice.readUInt32BE(offset); offset += 4;
|
|
@@ -282,6 +303,9 @@ function decodeFields(slice) {
|
|
|
282
303
|
case 's':
|
|
283
304
|
val = slice.readInt16BE(offset); offset += 2;
|
|
284
305
|
break;
|
|
306
|
+
case 'u':
|
|
307
|
+
val = slice.readUInt16BE(offset); offset += 2;
|
|
308
|
+
break;
|
|
285
309
|
case 't':
|
|
286
310
|
val = slice[offset] != 0; offset++;
|
|
287
311
|
break;
|
package/lib/connect.js
CHANGED
|
@@ -31,7 +31,7 @@ var CLIENT_PROPERTIES = {
|
|
|
31
31
|
"product": "amqplib",
|
|
32
32
|
"version": require('../package.json').version,
|
|
33
33
|
"platform": fmt('Node.JS %s', process.version),
|
|
34
|
-
"information": "
|
|
34
|
+
"information": "https://amqp-node.github.io/amqplib/",
|
|
35
35
|
"capabilities": {
|
|
36
36
|
"publisher_confirms": true,
|
|
37
37
|
"exchange_exchange_bindings": true,
|
|
@@ -66,7 +66,7 @@ function openFrames(vhost, query, credentials, extraClientProperties) {
|
|
|
66
66
|
|
|
67
67
|
// tune-ok
|
|
68
68
|
'channelMax': intOrDefault(query.channelMax, 0),
|
|
69
|
-
'frameMax': intOrDefault(query.frameMax,
|
|
69
|
+
'frameMax': intOrDefault(query.frameMax, 131072),
|
|
70
70
|
'heartbeat': intOrDefault(query.heartbeat, 0),
|
|
71
71
|
|
|
72
72
|
// open
|
package/lib/connection.js
CHANGED
|
@@ -10,9 +10,7 @@ var frame = require('./frame');
|
|
|
10
10
|
var HEARTBEAT = frame.HEARTBEAT;
|
|
11
11
|
var Mux = require('./mux').Mux;
|
|
12
12
|
|
|
13
|
-
var Duplex =
|
|
14
|
-
require('stream').Duplex ||
|
|
15
|
-
require('readable-stream/duplex');
|
|
13
|
+
var Duplex = require('stream').Duplex;
|
|
16
14
|
var EventEmitter = require('events');
|
|
17
15
|
var Heart = require('./heartbeat').Heart;
|
|
18
16
|
|
|
@@ -22,8 +20,7 @@ var inspect = require('./format').inspect;
|
|
|
22
20
|
|
|
23
21
|
var BitSet = require('./bitset').BitSet;
|
|
24
22
|
var fmt = require('util').format;
|
|
25
|
-
var PassThrough = require('stream').PassThrough
|
|
26
|
-
require('readable-stream/passthrough');
|
|
23
|
+
var PassThrough = require('stream').PassThrough;
|
|
27
24
|
var IllegalOperationError = require('./error').IllegalOperationError;
|
|
28
25
|
var stackCapture = require('./error').stackCapture;
|
|
29
26
|
|
package/package.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"name": "amqplib",
|
|
3
3
|
"homepage": "http://amqp-node.github.io/amqplib/",
|
|
4
4
|
"main": "./channel_api.js",
|
|
5
|
-
"version": "0.10.
|
|
5
|
+
"version": "0.10.6",
|
|
6
6
|
"description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/amqp-node/amqplib.git"
|
|
9
|
+
"url": "git+https://github.com/amqp-node/amqplib.git"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=10"
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@acuminous/bitsyntax": "^0.1.2",
|
|
16
16
|
"buffer-more-ints": "~1.0.0",
|
|
17
|
-
"readable-stream": "1.x >=1.1.9",
|
|
18
17
|
"url-parse": "~1.5.10"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
@@ -24,8 +23,7 @@
|
|
|
24
23
|
"uglify-js": "2.8.x"
|
|
25
24
|
},
|
|
26
25
|
"scripts": {
|
|
27
|
-
"test": "make test"
|
|
28
|
-
"prepare": "make"
|
|
26
|
+
"test": "make test"
|
|
29
27
|
},
|
|
30
28
|
"keywords": [
|
|
31
29
|
"AMQP",
|
package/test/callback_api.js
CHANGED
|
@@ -72,10 +72,14 @@ suite('updateSecret', function() {
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
function channel_test_fn(method) {
|
|
75
|
-
return function(name, chfun) {
|
|
75
|
+
return function(name, options, chfun) {
|
|
76
|
+
if (arguments.length === 2) {
|
|
77
|
+
chfun = options;
|
|
78
|
+
options = {};
|
|
79
|
+
}
|
|
76
80
|
test(name, function(done) {
|
|
77
81
|
connect(kCallback(function(c) {
|
|
78
|
-
c[method](kCallback(function(ch) {
|
|
82
|
+
c[method](options, kCallback(function(ch) {
|
|
79
83
|
chfun(ch, done);
|
|
80
84
|
}, done));
|
|
81
85
|
}, done));
|
|
@@ -210,6 +214,33 @@ suite('sending messages', function() {
|
|
|
210
214
|
});
|
|
211
215
|
});
|
|
212
216
|
|
|
217
|
+
var channelOptions = {};
|
|
218
|
+
|
|
219
|
+
channel_test('find high watermark', function(ch, done) {
|
|
220
|
+
var msg = randomString();
|
|
221
|
+
var baseline = 0;
|
|
222
|
+
ch.assertQueue('', {exclusive: true}, function(e, q) {
|
|
223
|
+
if (e !== null) return done(e);
|
|
224
|
+
while (ch.sendToQueue(q.queue, Buffer.from(msg))) {
|
|
225
|
+
baseline++;
|
|
226
|
+
};
|
|
227
|
+
channelOptions.highWaterMark = baseline * 2;
|
|
228
|
+
done();
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
channel_test('set high watermark', channelOptions, function(ch, done) {
|
|
233
|
+
var msg = randomString();
|
|
234
|
+
ch.assertQueue('', {exclusive: true}, function(e, q) {
|
|
235
|
+
if (e !== null) return done(e);
|
|
236
|
+
var ok;
|
|
237
|
+
for (var i = 0; i < channelOptions.highWaterMark; i++) {
|
|
238
|
+
ok = ch.sendToQueue(q.queue, Buffer.from(msg));
|
|
239
|
+
assert.equal(ok, true);
|
|
240
|
+
}
|
|
241
|
+
done();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
213
244
|
});
|
|
214
245
|
|
|
215
246
|
suite('ConfirmChannel', function() {
|
|
@@ -228,6 +259,34 @@ suite('ConfirmChannel', function() {
|
|
|
228
259
|
ch.waitForConfirms(done);
|
|
229
260
|
});
|
|
230
261
|
|
|
262
|
+
var channelOptions = {};
|
|
263
|
+
|
|
264
|
+
confirm_channel_test('find high watermark', function(ch, done) {
|
|
265
|
+
var msg = randomString();
|
|
266
|
+
var baseline = 0;
|
|
267
|
+
ch.assertQueue('', {exclusive: true}, function(e, q) {
|
|
268
|
+
if (e !== null) return done(e);
|
|
269
|
+
while (ch.sendToQueue(q.queue, Buffer.from(msg))) {
|
|
270
|
+
baseline++;
|
|
271
|
+
};
|
|
272
|
+
channelOptions.highWaterMark = baseline * 2;
|
|
273
|
+
done();
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
confirm_channel_test('set high watermark', channelOptions, function(ch, done) {
|
|
278
|
+
var msg = randomString();
|
|
279
|
+
ch.assertQueue('', {exclusive: true}, function(e, q) {
|
|
280
|
+
if (e !== null) return done(e);
|
|
281
|
+
var ok;
|
|
282
|
+
for (var i = 0; i < channelOptions.highWaterMark; i++) {
|
|
283
|
+
ok = ch.sendToQueue(q.queue, Buffer.from(msg));
|
|
284
|
+
assert.equal(ok, true);
|
|
285
|
+
}
|
|
286
|
+
done();
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
|
|
231
290
|
});
|
|
232
291
|
|
|
233
292
|
suite("Error handling", function() {
|
package/test/codec.js
CHANGED
|
@@ -44,19 +44,16 @@ var testCases = [
|
|
|
44
44
|
['null', {'void': null}, [4,118,111,105,100,86]],
|
|
45
45
|
|
|
46
46
|
// array, object
|
|
47
|
-
['array', {array: [6, true, "foo"]},
|
|
48
|
-
|
|
49
|
-
['object', {object: {foo: "bar", baz: 12}},
|
|
50
|
-
[6,111,98,106,101,99,116,70,0,0,0,18,3,102,111,111,83,0,
|
|
51
|
-
0,0,3,98,97,114,3,98,97,122,98,12]],
|
|
47
|
+
['array', {array: [6, true, "foo"]},[5,97,114,114,97,121,65,0,0,0,12,98,6,116,1,83,0,0,0,3,102,111,111]],
|
|
48
|
+
['object', {object: {foo: "bar", baz: 12}},[6,111,98,106,101,99,116,70,0,0,0,18,3,102,111,111,83,0,0,0,3,98,97,114,3,98,97,122,98,12]],
|
|
52
49
|
|
|
53
50
|
// exotic types
|
|
54
|
-
['timestamp', {timestamp: {'!': 'timestamp', value: 1357212277527}},
|
|
55
|
-
|
|
56
|
-
['
|
|
57
|
-
|
|
58
|
-
['
|
|
59
|
-
|
|
51
|
+
['timestamp', {timestamp: {'!': 'timestamp', value: 1357212277527}},[9,116,105,109,101,115,116,97,109,112,84,0,0,1,60,0,39,219,23]],
|
|
52
|
+
['decimal', {decimal: {'!': 'decimal', value: {digits: 2345, places: 2}}},[7,100,101,99,105,109,97,108,68,2,0,0,9,41]],
|
|
53
|
+
['float', {float: {'!': 'float', value: 0.1}},[5,102,108,111,97,116,102,61,204,204,205]],
|
|
54
|
+
['unsignedbyte', {unsignedbyte:{'!': 'unsignedbyte', value: 255}}, [12,117,110,115,105,103,110,101,100,98,121,116,101,66,255]],
|
|
55
|
+
['unsignedshort', {unsignedshort:{'!': 'unsignedshort', value: 65535}}, [13,117,110,115,105,103,110,101,100,115,104,111,114,116,117,255,255]],
|
|
56
|
+
['unsignedint', {unsignedint:{'!': 'unsignedint', value: 4294967295}}, [11,117,110,115,105,103,110,101,100,105,110,116,105,255,255,255,255]],
|
|
60
57
|
];
|
|
61
58
|
|
|
62
59
|
function bufferToArray(b) {
|
|
@@ -109,6 +106,9 @@ suite("Roundtrip values", function() {
|
|
|
109
106
|
amqp.Bit,
|
|
110
107
|
amqp.Decimal,
|
|
111
108
|
amqp.Timestamp,
|
|
109
|
+
amqp.UnsignedByte,
|
|
110
|
+
amqp.UnsignedShort,
|
|
111
|
+
amqp.UnsignedInt,
|
|
112
112
|
amqp.Double,
|
|
113
113
|
amqp.Float,
|
|
114
114
|
amqp.FieldArray,
|
package/test/data.js
CHANGED
|
@@ -89,6 +89,18 @@ var Decimal = label('decimal', transform(
|
|
|
89
89
|
function(args) {
|
|
90
90
|
return {'!': 'decimal', value: {places: args[1], digits: args[0]}};
|
|
91
91
|
}, sequence(arb.UInt, Octet)));
|
|
92
|
+
var UnsignedByte = label('unsignedbyte', transform(
|
|
93
|
+
function(n) {
|
|
94
|
+
return {'!': 'unsignedbyte', value: n};
|
|
95
|
+
}, Octet));
|
|
96
|
+
var UnsignedShort = label('unsignedshort', transform(
|
|
97
|
+
function(n) {
|
|
98
|
+
return {'!': 'unsignedshort', value: n};
|
|
99
|
+
}, UShort));
|
|
100
|
+
var UnsignedInt = label('unsignedint', transform(
|
|
101
|
+
function(n) {
|
|
102
|
+
return {'!': 'unsignedint', value: n};
|
|
103
|
+
}, ULong));
|
|
92
104
|
|
|
93
105
|
// Signed 8 bit int
|
|
94
106
|
var Byte = rangeInt('byte', -128, 127);
|
|
@@ -244,6 +256,9 @@ module.exports = {
|
|
|
244
256
|
Float: Float,
|
|
245
257
|
Timestamp: Timestamp,
|
|
246
258
|
Decimal: Decimal,
|
|
259
|
+
UnsignedByte: UnsignedByte,
|
|
260
|
+
UnsignedShort: UnsignedShort,
|
|
261
|
+
UnsignedInt: UnsignedInt,
|
|
247
262
|
FieldArray: FieldArray,
|
|
248
263
|
FieldTable: FieldTable,
|
|
249
264
|
|
package/test/frame.js
CHANGED
|
@@ -7,8 +7,7 @@ var connection = require('../lib/connection');
|
|
|
7
7
|
var Frames = connection.Connection;
|
|
8
8
|
var HEARTBEAT = require('../lib/frame').HEARTBEAT;
|
|
9
9
|
var Stream = require('stream');
|
|
10
|
-
var PassThrough = Stream.PassThrough
|
|
11
|
-
require('readable-stream/passthrough');
|
|
10
|
+
var PassThrough = Stream.PassThrough;
|
|
12
11
|
|
|
13
12
|
var defs = require('../lib/defs');
|
|
14
13
|
|
package/test/mux.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var assert = require('assert');
|
|
4
4
|
var Mux = require('../lib/mux').Mux;
|
|
5
|
-
var PassThrough = require('stream').PassThrough
|
|
6
|
-
require('readable-stream/passthrough');
|
|
5
|
+
var PassThrough = require('stream').PassThrough;
|
|
7
6
|
|
|
8
7
|
var latch = require('./util').latch;
|
|
9
8
|
var schedule = require('./util').schedule;
|
package/test/util.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
4
|
var Connection = require('../lib/connection').Connection;
|
|
5
|
-
var PassThrough =
|
|
6
|
-
require('stream').PassThrough ||
|
|
7
|
-
require('readable-stream/passthrough');
|
|
5
|
+
var PassThrough = require('stream').PassThrough;
|
|
8
6
|
var defs = require('../lib/defs');
|
|
9
7
|
var assert = require('assert');
|
|
10
8
|
|