@5minds/node-red-contrib-processcube 1.8.1-develop-6dff8c-m73e1huc → 1.8.2-develop-dfcb5e-m7a8z2fk
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.
@@ -745,13 +745,13 @@
|
|
745
745
|
"type": "externaltask-input",
|
746
746
|
"z": "a23d2e782beb66f4",
|
747
747
|
"g": "31cb6729aac0ba46",
|
748
|
-
"name": "",
|
748
|
+
"name": "SampleError",
|
749
749
|
"engine": "42e6796dddd9d4db",
|
750
750
|
"topic": "SampleError",
|
751
751
|
"topicType": "str",
|
752
752
|
"workerConfig": "{}",
|
753
753
|
"workerConfigType": "json",
|
754
|
-
"x":
|
754
|
+
"x": 110,
|
755
755
|
"y": 480,
|
756
756
|
"wires": [
|
757
757
|
[
|
@@ -996,6 +996,7 @@
|
|
996
996
|
"id": "3283986789f6f865",
|
997
997
|
"type": "externaltask-input",
|
998
998
|
"z": "a23d2e782beb66f4",
|
999
|
+
"d": true,
|
999
1000
|
"g": "73ca179de59cdabf",
|
1000
1001
|
"name": "TopicFromENV",
|
1001
1002
|
"engine": "42e6796dddd9d4db",
|
@@ -1091,6 +1092,7 @@
|
|
1091
1092
|
"id": "53a1d67f1dfa05fe",
|
1092
1093
|
"type": "externaltask-input",
|
1093
1094
|
"z": "a23d2e782beb66f4",
|
1095
|
+
"d": true,
|
1094
1096
|
"g": "be22a2d8eb2e28c4",
|
1095
1097
|
"name": "the_simple_topic",
|
1096
1098
|
"engine": "42e6796dddd9d4db",
|
@@ -1285,10 +1287,12 @@
|
|
1285
1287
|
"id": "d0e1fa5361aba536",
|
1286
1288
|
"type": "externaltask-input",
|
1287
1289
|
"z": "c9ab699769824f2f",
|
1290
|
+
"d": true,
|
1288
1291
|
"g": "bb94db89ecb73d7b",
|
1289
1292
|
"name": "Test_Auth",
|
1290
1293
|
"engine": "b78932d162d8d468",
|
1291
1294
|
"topic": "Test_Auth",
|
1295
|
+
"topicType": "str",
|
1292
1296
|
"workerConfig": "{}",
|
1293
1297
|
"workerConfigType": "json",
|
1294
1298
|
"x": 120,
|
@@ -1350,10 +1354,12 @@
|
|
1350
1354
|
"id": "7af11dd03dd0fc02",
|
1351
1355
|
"type": "externaltask-input",
|
1352
1356
|
"z": "c9ab699769824f2f",
|
1357
|
+
"d": true,
|
1353
1358
|
"g": "ec665c16c4c4a6e0",
|
1354
1359
|
"name": "SampleError_Auth",
|
1355
1360
|
"engine": "b78932d162d8d468",
|
1356
1361
|
"topic": "SampleError_Auth",
|
1362
|
+
"topicType": "str",
|
1357
1363
|
"workerConfig": "{}",
|
1358
1364
|
"workerConfigType": "json",
|
1359
1365
|
"x": 150,
|
package/externaltask-input.js
CHANGED
@@ -11,6 +11,10 @@ module.exports = function (RED) {
|
|
11
11
|
node.engine = RED.nodes.getNode(config.engine);
|
12
12
|
|
13
13
|
node.eventEmitter = new EventEmitter();
|
14
|
+
|
15
|
+
let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
|
16
|
+
let topic = node.topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
|
17
|
+
|
14
18
|
|
15
19
|
node._subscribed = true;
|
16
20
|
node._subscribed_error = null;
|
@@ -25,13 +29,15 @@ module.exports = function (RED) {
|
|
25
29
|
this._subscribed = false;
|
26
30
|
this._subscribed_error = error;
|
27
31
|
|
28
|
-
this.error(`subscription failed (${
|
32
|
+
this.error(`subscription failed (topic: ${node.topic}).`);
|
33
|
+
RED.log.error(`topic: ${node.topic} (${error.message}).`);
|
29
34
|
|
30
35
|
this.showStatus();
|
31
36
|
};
|
32
37
|
|
33
38
|
node.setStartHandlingTaskStatus = (externalTask) => {
|
34
39
|
this._subscribed = true;
|
40
|
+
this._subscribed_error = null;
|
35
41
|
this.started_external_tasks[externalTask.flowNodeInstanceId] = externalTask;
|
36
42
|
|
37
43
|
this.showStatus();
|
@@ -42,6 +48,21 @@ module.exports = function (RED) {
|
|
42
48
|
delete this.started_external_tasks[externalTask.flowNodeInstanceId];
|
43
49
|
}
|
44
50
|
|
51
|
+
this._subscribed = true;
|
52
|
+
this._subscribed_error = null;
|
53
|
+
|
54
|
+
this.showStatus();
|
55
|
+
};
|
56
|
+
|
57
|
+
node.setErrorFinishHandlingTaskStatus = (externalTask, error) => {
|
58
|
+
if (externalTask.flowNodeInstanceId) {
|
59
|
+
delete this.started_external_tasks[externalTask.flowNodeInstanceId];
|
60
|
+
}
|
61
|
+
|
62
|
+
this._subscribed_error = error;
|
63
|
+
this.error(`finished task failed (topic: ${node.topic}).`);
|
64
|
+
RED.log.error(`topic: ${node.topic} (${error.message}).`);
|
65
|
+
|
45
66
|
this.showStatus();
|
46
67
|
};
|
47
68
|
|
@@ -49,17 +70,13 @@ module.exports = function (RED) {
|
|
49
70
|
const msgCounter = Object.keys(this.started_external_tasks).length;
|
50
71
|
|
51
72
|
if (this._subscribed === false) {
|
52
|
-
this.status({ fill: 'red', shape: 'ring', text: `subscription failed.` })
|
73
|
+
this.status({ fill: 'red', shape: 'ring', text: `subscription failed (${msgCounter}).` })
|
53
74
|
} else {
|
54
75
|
if (msgCounter >= 1) {
|
55
76
|
this.status({ fill: 'green', shape: 'dot', text: `handling tasks ${msgCounter}.` });
|
56
77
|
this.log(`handling tasks ${msgCounter}.`);
|
57
78
|
} else {
|
58
79
|
this.status({ fill: 'blue', shape: 'ring', text: `subcribed.` });
|
59
|
-
|
60
|
-
if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING) {
|
61
|
-
this.log(`subcribed (heartbeat).`);
|
62
|
-
}
|
63
80
|
}
|
64
81
|
}
|
65
82
|
};
|
@@ -73,6 +90,7 @@ module.exports = function (RED) {
|
|
73
90
|
node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
|
74
91
|
}
|
75
92
|
}
|
93
|
+
|
76
94
|
const client = node.engine.engineClient;
|
77
95
|
|
78
96
|
if (!client) {
|
@@ -80,11 +98,14 @@ module.exports = function (RED) {
|
|
80
98
|
return;
|
81
99
|
}
|
82
100
|
const etwCallback = async (payload, externalTask) => {
|
83
|
-
const saveHandleCallback = (data, callback) => {
|
101
|
+
const saveHandleCallback = (data, callback, msg) => {
|
84
102
|
try {
|
85
103
|
callback(data);
|
104
|
+
node.setFinishHandlingTaskStatus(externalTask);
|
86
105
|
} catch (error) {
|
87
|
-
node.
|
106
|
+
node.setErrorFinishHandlingTaskStatus(externalTask, error);
|
107
|
+
msg.error = error;
|
108
|
+
node.error(`Error in callback 'saveHandleCallback': ${error.message}`, msg);
|
88
109
|
}
|
89
110
|
};
|
90
111
|
|
@@ -100,10 +121,8 @@ module.exports = function (RED) {
|
|
100
121
|
`handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${JSON.stringify(result)} on msg._msgid ${msg._msgid}.`
|
101
122
|
);
|
102
123
|
|
103
|
-
node.setFinishHandlingTaskStatus(externalTask);
|
104
|
-
|
105
124
|
//resolve(result);
|
106
|
-
saveHandleCallback(result, resolve);
|
125
|
+
saveHandleCallback(result, resolve, msg);
|
107
126
|
};
|
108
127
|
|
109
128
|
const handleErrorTask = (msg) => {
|
@@ -111,13 +130,11 @@ module.exports = function (RED) {
|
|
111
130
|
`handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`
|
112
131
|
);
|
113
132
|
|
114
|
-
node.setFinishHandlingTaskStatus(externalTask);
|
115
|
-
|
116
133
|
// TODO: with reject, the default error handling is proceed
|
117
134
|
// SEE: https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
|
118
135
|
// reject(result);
|
119
136
|
//resolve(msg);
|
120
|
-
saveHandleCallback(msg, resolve);
|
137
|
+
saveHandleCallback(msg, resolve, msg);
|
121
138
|
};
|
122
139
|
|
123
140
|
node.eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
|
@@ -151,9 +168,6 @@ module.exports = function (RED) {
|
|
151
168
|
});
|
152
169
|
};
|
153
170
|
|
154
|
-
let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
|
155
|
-
let topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
|
156
|
-
|
157
171
|
client.externalTasks
|
158
172
|
.subscribeToExternalTaskTopic(topic, etwCallback, options)
|
159
173
|
.then(async (externalTaskWorker) => {
|
@@ -161,8 +175,16 @@ module.exports = function (RED) {
|
|
161
175
|
|
162
176
|
node.etw = externalTaskWorker;
|
163
177
|
|
164
|
-
externalTaskWorker.onHeartbeat(() => {
|
178
|
+
externalTaskWorker.onHeartbeat((event, external_task_id) => {
|
165
179
|
node.setSubscribedStatus();
|
180
|
+
|
181
|
+
if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING) {
|
182
|
+
if (external_task_id) {
|
183
|
+
this.log(`subscription (heartbeat:topic ${node.topic}, ${event} for ${external_task_id}).`);
|
184
|
+
} else {
|
185
|
+
this.log(`subscription (heartbeat:topic ${node.topic}, ${event}).`);
|
186
|
+
}
|
187
|
+
}
|
166
188
|
});
|
167
189
|
|
168
190
|
externalTaskWorker.onWorkerError((errorType, error, externalTask) => {
|
@@ -171,15 +193,15 @@ module.exports = function (RED) {
|
|
171
193
|
case 'finishExternalTask':
|
172
194
|
case 'processExternalTask':
|
173
195
|
node.error(
|
174
|
-
`Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}
|
175
|
-
{}
|
196
|
+
`Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}`
|
176
197
|
);
|
177
198
|
|
178
|
-
if (externalTask) {
|
179
|
-
|
180
|
-
}
|
199
|
+
//if (externalTask) {
|
200
|
+
// delete node.started_external_tasks[externalTask.flowNodeInstanceId];
|
201
|
+
//}
|
202
|
+
|
203
|
+
node.setUnsubscribedStatus(error);
|
181
204
|
|
182
|
-
showStatus(node, Object.keys(node.started_external_tasks).length);
|
183
205
|
break;
|
184
206
|
case 'fetchAndLock':
|
185
207
|
node.setUnsubscribedStatus(error);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "1.8.
|
3
|
+
"version": "1.8.2-develop-dfcb5e-m7a8z2fk",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"scripts": {
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"examples": "examples"
|
60
60
|
},
|
61
61
|
"dependencies": {
|
62
|
-
"@5minds/processcube_engine_client": "5.1.
|
62
|
+
"@5minds/processcube_engine_client": "5.1.10",
|
63
63
|
"jwt-decode": "^4.0.0",
|
64
64
|
"openid-client": "^5.5.0"
|
65
65
|
},
|
@@ -73,12 +73,12 @@
|
|
73
73
|
<bpmndi:BPMNShape id="Event_0rs3geg_di" bpmnElement="Event_0rs3geg">
|
74
74
|
<dc:Bounds x="312" y="272" width="36" height="36" />
|
75
75
|
</bpmndi:BPMNShape>
|
76
|
-
<bpmndi:BPMNShape id="Event_134k5nt_di" bpmnElement="Event_0o7qlkd">
|
77
|
-
<dc:Bounds x="392" y="192" width="36" height="36" />
|
78
|
-
</bpmndi:BPMNShape>
|
79
76
|
<bpmndi:BPMNShape id="Event_03ytp91_di" bpmnElement="Event_007u06e">
|
80
77
|
<dc:Bounds x="222" y="192" width="36" height="36" />
|
81
78
|
</bpmndi:BPMNShape>
|
79
|
+
<bpmndi:BPMNShape id="Event_134k5nt_di" bpmnElement="Event_0o7qlkd">
|
80
|
+
<dc:Bounds x="392" y="192" width="36" height="36" />
|
81
|
+
</bpmndi:BPMNShape>
|
82
82
|
<bpmndi:BPMNEdge id="Flow_0qmxzxk_di" bpmnElement="Flow_0qmxzxk">
|
83
83
|
<di:waypoint x="128" y="170" />
|
84
84
|
<di:waypoint x="180" y="170" />
|