@5minds/node-red-contrib-processcube-amqp 0.4.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.
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "@5minds/node-red-contrib-processcube-amqp": {
431
431
  "name": "@5minds/node-red-contrib-processcube-amqp",
432
- "version": "0.2.0",
432
+ "version": "0.4.0",
433
433
  "local": true,
434
434
  "user": false,
435
435
  "nodes": {
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "@5minds/node-red-contrib-processcube-amqp": {
431
431
  "name": "@5minds/node-red-contrib-processcube-amqp",
432
- "version": "0.1.0",
432
+ "version": "0.2.0",
433
433
  "local": true,
434
434
  "user": false,
435
435
  "nodes": {
@@ -23,7 +23,7 @@
23
23
  "routingKey": "",
24
24
  "queue": "Test",
25
25
  "x": 210,
26
- "y": 260,
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": "Test2__",
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": 260,
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.test",
92
+ "routingKey": "test.${TEST}",
93
+ "routingKeyFieldType": "env",
92
94
  "x": 630,
93
95
  "y": 140,
94
96
  "wires": []
@@ -481,6 +481,7 @@ module.exports = {
481
481
  */
482
482
  functionGlobalContext: {
483
483
  // os:require('os'),
484
+ env: process.env
484
485
  },
485
486
 
486
487
  /** The maximum number of messages nodes will buffer internally as part of their
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 wide-label-amqp-in routing-key-form-input">
56
- <label for="node-input-routingKey"><i class="fa fa-filter"></i>&nbsp;&nbsp;Routing Key</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, config.routingKey);
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 wide-label-amqp-in routing-key-form-input">
55
- <label for="node-input-routingKey"><i class="fa fa-filter"></i>&nbsp;&nbsp;Routing Key</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, config.routingKey, Buffer.from(JSON.stringify(msg.payload)));
25
+ await channel.publish(config.exchange, routingKey, Buffer.from(JSON.stringify(msg.payload)));
24
26
  await channel.close();
25
27
  });
26
28
 
@@ -5,6 +5,7 @@ services:
5
5
  context: .
6
6
  environment:
7
7
  - TZ=Europe/Berlin
8
+ - TEST=hallo
8
9
  ports:
9
10
  - "1880:1880"
10
11
  volumes:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube-amqp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for AMQP",
6
6
  "authors": [