@5minds/node-red-contrib-processcube-amqp 0.3.0 → 0.5.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/.node-red/data/.config.nodes.json +1 -1
- package/.node-red/data/.config.nodes.json.backup +1 -1
- package/.node-red/data/.flows.json.backup +4 -3
- package/.node-red/data/flows.json +5 -3
- package/.node-red/data/settings.js +1 -0
- package/amqp-input.html +9 -2
- package/amqp-input.js +3 -1
- package/amqp-output.html +10 -3
- package/amqp-output.js +3 -1
- package/docker-compose.yml +1 -0
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"routingKey": "",
|
|
24
24
|
"queue": "Test",
|
|
25
25
|
"x": 210,
|
|
26
|
-
"y":
|
|
26
|
+
"y": 240,
|
|
27
27
|
"wires": [
|
|
28
28
|
[
|
|
29
29
|
"ad189622d10f3966"
|
|
@@ -52,9 +52,10 @@
|
|
|
52
52
|
"z": "ea5e703747705005",
|
|
53
53
|
"name": "",
|
|
54
54
|
"amqpServer": "cbcfcb0a896f9765",
|
|
55
|
-
"exchange": "
|
|
55
|
+
"exchange": "Test2",
|
|
56
56
|
"exchangeType": "topic",
|
|
57
|
-
"routingKey": "test
|
|
57
|
+
"routingKey": "test.${TEST}",
|
|
58
|
+
"routingKeyFieldType": "env",
|
|
58
59
|
"queue": "Test2",
|
|
59
60
|
"x": 210,
|
|
60
61
|
"y": 380,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"routingKey": "",
|
|
24
24
|
"queue": "Test",
|
|
25
25
|
"x": 210,
|
|
26
|
-
"y":
|
|
26
|
+
"y": 240,
|
|
27
27
|
"wires": [
|
|
28
28
|
[
|
|
29
29
|
"ad189622d10f3966"
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"amqpServer": "cbcfcb0a896f9765",
|
|
55
55
|
"exchange": "Test2",
|
|
56
56
|
"exchangeType": "topic",
|
|
57
|
-
"routingKey": "test
|
|
57
|
+
"routingKey": "test.${TEST}",
|
|
58
|
+
"routingKeyFieldType": "env",
|
|
58
59
|
"queue": "Test2",
|
|
59
60
|
"x": 210,
|
|
60
61
|
"y": 380,
|
|
@@ -88,7 +89,8 @@
|
|
|
88
89
|
"amqpServer": "cbcfcb0a896f9765",
|
|
89
90
|
"exchange": "Test2",
|
|
90
91
|
"exchangeType": "topic",
|
|
91
|
-
"routingKey": "test
|
|
92
|
+
"routingKey": "test.${TEST}",
|
|
93
|
+
"routingKeyFieldType": "env",
|
|
92
94
|
"x": 630,
|
|
93
95
|
"y": 140,
|
|
94
96
|
"wires": []
|
package/amqp-input.html
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
exchange: {value: "", type: "string", required:true},
|
|
9
9
|
exchangeType: { value: 'fanout'},
|
|
10
10
|
routingKey: { value: "" },
|
|
11
|
+
routingKeyFieldType: { value: "str"},
|
|
11
12
|
queue: {value: "", type: "string", required:true}
|
|
12
13
|
},
|
|
13
14
|
inputs: 0,
|
|
@@ -27,6 +28,11 @@
|
|
|
27
28
|
$('.routing-key-form-input').show()
|
|
28
29
|
}
|
|
29
30
|
})
|
|
31
|
+
|
|
32
|
+
$("#node-input-routingKey").typedInput({
|
|
33
|
+
typeField: "#node-input-routingKeyFieldType",
|
|
34
|
+
types: ["str","env"]
|
|
35
|
+
});
|
|
30
36
|
},
|
|
31
37
|
});
|
|
32
38
|
</script>
|
|
@@ -52,9 +58,10 @@
|
|
|
52
58
|
<label for="node-input-exchange"><i class="fa fa-tag"></i> Exchange</label>
|
|
53
59
|
<input type="text" id="node-input-exchange" placeholder="Exchange">
|
|
54
60
|
</div>
|
|
55
|
-
<div class="form-row
|
|
56
|
-
<label
|
|
61
|
+
<div class="form-row routing-key-form-input">
|
|
62
|
+
<label>Routing key:</label>
|
|
57
63
|
<input type="text" id="node-input-routingKey">
|
|
64
|
+
<input type="hidden" id="node-input-routingKeyFieldType">
|
|
58
65
|
</div>
|
|
59
66
|
<div class="form-row">
|
|
60
67
|
<label for="node-input-queue"><i class="fa fa-tag"></i> Queue</label>
|
package/amqp-input.js
CHANGED
|
@@ -25,11 +25,13 @@ module.exports = function(RED) {
|
|
|
25
25
|
flowContext.set('amqpConnection', connection);
|
|
26
26
|
await connection.connect();
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
const routingKey = (config.exchangeType == 'topic') ? RED.util.evaluateNodeProperty(config.routingKey, config.routingKeyFieldType, node) : '';
|
|
28
30
|
|
|
29
31
|
const channel = await connection.createChannel();
|
|
30
32
|
await channel.assertExchange(config.exchange, config.exchangeType);
|
|
31
33
|
const queue = await channel.assertQueue(config.queue);
|
|
32
|
-
await channel.bindQueue(queue.queue, config.exchange,
|
|
34
|
+
await channel.bindQueue(queue.queue, config.exchange, routingKey);
|
|
33
35
|
|
|
34
36
|
await channel.consume(queue.queue, async (message) => {
|
|
35
37
|
const msg = {
|
package/amqp-output.html
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
exchange: {value: "", type: "string", required:true},
|
|
9
9
|
exchangeType: { value: 'fanout'},
|
|
10
10
|
routingKey: { value: "" },
|
|
11
|
+
routingKeyFieldType: { value: "str"},
|
|
11
12
|
},
|
|
12
13
|
inputs: 1,
|
|
13
14
|
outputs: 0,
|
|
@@ -25,7 +26,12 @@
|
|
|
25
26
|
} else {
|
|
26
27
|
$('.routing-key-form-input').show()
|
|
27
28
|
}
|
|
28
|
-
})
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
$("#node-input-routingKey").typedInput({
|
|
32
|
+
typeField: "#node-input-routingKeyFieldType",
|
|
33
|
+
types: ["str","env"]
|
|
34
|
+
});
|
|
29
35
|
},
|
|
30
36
|
});
|
|
31
37
|
</script>
|
|
@@ -51,9 +57,10 @@
|
|
|
51
57
|
<label for="node-input-exchange"><i class="fa fa-tag"></i> Exchange</label>
|
|
52
58
|
<input type="text" id="node-input-exchange" placeholder="Exchange">
|
|
53
59
|
</div>
|
|
54
|
-
<div class="form-row
|
|
55
|
-
<label
|
|
60
|
+
<div class="form-row routing-key-form-input">
|
|
61
|
+
<label>Routing key:</label>
|
|
56
62
|
<input type="text" id="node-input-routingKey">
|
|
63
|
+
<input type="hidden" id="node-input-routingKeyFieldType">
|
|
57
64
|
</div>
|
|
58
65
|
</script>
|
|
59
66
|
|
package/amqp-output.js
CHANGED
|
@@ -16,11 +16,13 @@ module.exports = function(RED) {
|
|
|
16
16
|
connection = new AMQPConnection(amqpServer.connectionString);
|
|
17
17
|
flowContext.set('amqpConnection', connection);
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
const routingKey = (config.exchangeType == 'topic') ? RED.util.evaluateNodeProperty(config.routingKey, config.routingKeyFieldType, node) : '';
|
|
19
21
|
|
|
20
22
|
const channel = await connection.createChannel();
|
|
21
23
|
await channel.assertExchange(config.exchange, config.exchangeType);
|
|
22
24
|
|
|
23
|
-
await channel.publish(config.exchange,
|
|
25
|
+
await channel.publish(config.exchange, routingKey, Buffer.from(JSON.stringify(msg.payload)));
|
|
24
26
|
await channel.close();
|
|
25
27
|
});
|
|
26
28
|
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-contrib-processcube-amqp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node-RED nodes for AMQP",
|
|
6
6
|
"authors": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=14",
|
|
26
|
-
"npm": ">=
|
|
26
|
+
"npm": ">=8.19.4"
|
|
27
27
|
},
|
|
28
28
|
"node-red": {
|
|
29
29
|
"version": ">=3.1.9",
|