amqplib 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +8 -0
- package/CHANGELOG.md +39 -1
- package/Makefile +3 -2
- package/README.md +1 -1
- package/bin/generate-defs.js +723 -0
- package/examples/tutorials/package.json +1 -1
- package/lib/channel.js +6 -0
- package/lib/defs.js +1 -1
- package/lib/mux.js +6 -21
- package/package-lock.json +711 -0
- package/package.json +3 -3
- package/test/channel_api.js +13 -0
- package/test/mux.js +34 -0
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"name": "amqplib",
|
|
3
3
|
"homepage": "http://squaremo.github.io/amqp.node/",
|
|
4
4
|
"main": "./channel_api.js",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.0",
|
|
6
6
|
"description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/squaremo/amqp.node.git"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=0.8 <=
|
|
12
|
+
"node": ">=0.8 <=14"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"bitsyntax": "~0.1.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"test": "make test",
|
|
30
|
-
"
|
|
30
|
+
"prepare": "make"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"AMQP",
|
package/test/channel_api.js
CHANGED
|
@@ -581,4 +581,17 @@ confirmtest('wait for confirms', function(ch) {
|
|
|
581
581
|
return ch.waitForConfirms();
|
|
582
582
|
})
|
|
583
583
|
|
|
584
|
+
confirmtest('works when channel is closed', function(ch) {
|
|
585
|
+
for (var i=0; i < 1000; i++) {
|
|
586
|
+
ch.publish('', '', Buffer.from('foobar'), {});
|
|
587
|
+
}
|
|
588
|
+
return ch.close().then(function () {
|
|
589
|
+
return ch.waitForConfirms()
|
|
590
|
+
}).then(function () {
|
|
591
|
+
assert.strictEqual(true, false, 'Wait should have failed.')
|
|
592
|
+
}, function (e) {
|
|
593
|
+
assert.strictEqual(e.message, 'channel closed')
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
|
|
584
597
|
});
|
package/test/mux.js
CHANGED
|
@@ -51,6 +51,40 @@ test("single input", function(done) {
|
|
|
51
51
|
input.end();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
test("single input, resuming stream", function(done) {
|
|
55
|
+
var input = stream();
|
|
56
|
+
var output = stream();
|
|
57
|
+
input.on('end', function() { output.end() });
|
|
58
|
+
|
|
59
|
+
var mux = new Mux(output);
|
|
60
|
+
mux.pipeFrom(input);
|
|
61
|
+
|
|
62
|
+
// Streams might be blocked and become readable again, simulate this
|
|
63
|
+
// using a special read function and a marker
|
|
64
|
+
var data = [1,2,3,4,'skip',6,7,8,9];
|
|
65
|
+
|
|
66
|
+
var oldRead = input.read;
|
|
67
|
+
input.read = function(size) {
|
|
68
|
+
var val = oldRead.call(input, size)
|
|
69
|
+
|
|
70
|
+
if (val === 'skip') {
|
|
71
|
+
input.emit('readable');
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return val;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
data.forEach(input.write.bind(input));
|
|
79
|
+
|
|
80
|
+
readAllObjects(output, function(vals) {
|
|
81
|
+
assert.deepEqual([1,2,3,4,6,7,8,9], vals);
|
|
82
|
+
done();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
input.end();
|
|
86
|
+
});
|
|
87
|
+
|
|
54
88
|
test("two sequential inputs", function(done) {
|
|
55
89
|
var input1 = stream();
|
|
56
90
|
var input2 = stream();
|