@5minds/node-red-contrib-processcube 0.14.0-feature-e0a989-lyy06ngq → 0.14.0-feature-ef048b-lyy1ngi6
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/externaltask-input.js
CHANGED
@@ -30,6 +30,14 @@ module.exports = function(RED) {
|
|
30
30
|
client.externalTasks.subscribeToExternalTaskTopic(
|
31
31
|
config.topic,
|
32
32
|
async (payload, externalTask) => {
|
33
|
+
|
34
|
+
const saveHandleCallback = (data, callback) => {
|
35
|
+
try {
|
36
|
+
callback(data);
|
37
|
+
} catch (error) {
|
38
|
+
node.error(`Error in callback 'saveHandleCallback': ${error.message}`);
|
39
|
+
}
|
40
|
+
};
|
33
41
|
|
34
42
|
return await new Promise((resolve, reject) => {
|
35
43
|
|
@@ -45,7 +53,8 @@ module.exports = function(RED) {
|
|
45
53
|
showStatus(node, Object.keys(started_external_tasks).length);
|
46
54
|
|
47
55
|
|
48
|
-
resolve(result);
|
56
|
+
//resolve(result);
|
57
|
+
saveHandleCallback(result, resolve)
|
49
58
|
};
|
50
59
|
|
51
60
|
const handleErrorTask = (msg) => {
|
@@ -62,7 +71,8 @@ module.exports = function(RED) {
|
|
62
71
|
// TODO: with reject, the default error handling is proceed
|
63
72
|
// SEE: https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
|
64
73
|
// reject(result);
|
65
|
-
resolve(msg);
|
74
|
+
//resolve(msg);
|
75
|
+
saveHandleCallback(msg, resolve);
|
66
76
|
};
|
67
77
|
|
68
78
|
eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
|
@@ -121,7 +131,11 @@ module.exports = function(RED) {
|
|
121
131
|
}
|
122
132
|
});
|
123
133
|
|
124
|
-
|
134
|
+
try {
|
135
|
+
externalTaskWorker.start();
|
136
|
+
} catch (error) {
|
137
|
+
node.error(`Worker start 'externalTaskWorker.start' failed: ${error.message}`);
|
138
|
+
}
|
125
139
|
|
126
140
|
node.on("close", () => {
|
127
141
|
try {
|
@@ -131,7 +145,9 @@ module.exports = function(RED) {
|
|
131
145
|
}
|
132
146
|
});
|
133
147
|
}
|
134
|
-
)
|
148
|
+
).error((error) => {
|
149
|
+
node.error(`Error in subscribeToExternalTaskTopic: ${error.message}`);
|
150
|
+
});
|
135
151
|
}
|
136
152
|
|
137
153
|
RED.nodes.registerType("externaltask-input", ExternalTaskInput);
|
@@ -210,7 +210,7 @@
|
|
210
210
|
"g": "31cb6729aac0ba46",
|
211
211
|
"name": "",
|
212
212
|
"pauseType": "delay",
|
213
|
-
"timeout": "
|
213
|
+
"timeout": "15",
|
214
214
|
"timeoutUnits": "seconds",
|
215
215
|
"rate": "1",
|
216
216
|
"nbRateUnits": "1",
|
@@ -221,7 +221,7 @@
|
|
221
221
|
"drop": false,
|
222
222
|
"allowrate": false,
|
223
223
|
"outputs": 1,
|
224
|
-
"x":
|
224
|
+
"x": 330,
|
225
225
|
"y": 360,
|
226
226
|
"wires": [
|
227
227
|
[
|