@5minds/node-red-contrib-processcube 1.9.3 → 1.9.4

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.
@@ -4,6 +4,7 @@
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
6
  name: { value: '' },
7
+ workername: { value: '' },
7
8
  engine: { value: '', type: 'processcube-engine-config' },
8
9
  topic: { value: '' },
9
10
  topicType: { value: '' },
@@ -51,6 +52,10 @@
51
52
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
52
53
  <input type="text" id="node-input-name" placeholder="Name" />
53
54
  </div>
55
+ <div class="form-row">
56
+ <label for="node-input-workername"><i class="fa fa-tag"></i> Workername</label>
57
+ <input type="text" id="node-input-workername" placeholder="(optional) Workername" />
58
+ </div>
54
59
  <div class="form-row">
55
60
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
56
61
  <input type="text" id="node-input-engine" placeholder="Engine" />
@@ -72,6 +77,8 @@ the connected ProcessCube Engine for processing.
72
77
  ## Configs
73
78
 
74
79
  : name (string) : The name of the node
80
+ : workername (string) : The optional name of the worker otherwise it will be generated with the pattern
81
+ nodered:NODERED_NAME-host:HOST_NAME-pid:PID-id:ID of the node
75
82
  : engine (engine-node) : The ProcessCube Engine to connect to
76
83
  : topic (string) : The topic of the external task
77
84
  : workerConfig (object) : The configuration for the worker
@@ -1,6 +1,9 @@
1
1
  const EventEmitter = require('node:events');
2
2
 
3
3
  module.exports = function (RED) {
4
+
5
+ const os = require('os');
6
+
4
7
  function ExternalTaskInput(config) {
5
8
  RED.nodes.createNode(this, config);
6
9
  var node = this;
@@ -13,7 +16,17 @@ module.exports = function (RED) {
13
16
 
14
17
  let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
15
18
  let topic = node.topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
19
+ this.workername = RED.util.evaluateNodeProperty(config.workername, config.workernameType, node);
16
20
 
21
+ if (!options['workerId']) {
22
+
23
+ if (!this.workername) {
24
+ this.workername = `nodered:${process.env.NODERED_NAME || ''}-host:${os.hostname()}-pid:${process.pid}-id:${node.id}`;
25
+ }
26
+
27
+ options['workerId'] = this.workername;
28
+ }
29
+
17
30
  node._subscribed = true;
18
31
  node._subscribed_error = null;
19
32
  node._trace = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {