@5minds/node-red-contrib-processcube 1.5.5-feature-22f94f-m3eulbpf → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,29 +13,37 @@ module.exports = function (RED) {
13
13
  }
14
14
 
15
15
  let currentIdentity = node.engine.identity;
16
- let subscription = await client.events.onEndEventFinished(
17
- (endEventFinished) => {
18
- node.send({
19
- payload: endEventFinished,
20
- });
21
- },
22
- { identity: currentIdentity },
23
- );
24
-
25
- node.engine.registerOnIdentityChanged(async (identity) => {
26
- client.events.removeSubscription(subscription, currentIdentity);
27
-
28
- currentIdentity = identity;
29
16
 
17
+ let subscription = null;
18
+
19
+ try {
30
20
  subscription = await client.events.onEndEventFinished(
31
21
  (endEventFinished) => {
32
22
  node.send({
33
- payload: endEventFinished
23
+ payload: endEventFinished,
34
24
  });
35
25
  },
36
26
  { identity: currentIdentity },
37
27
  );
38
- });
28
+
29
+ node.engine.registerOnIdentityChanged(async (identity) => {
30
+ client.events.removeSubscription(subscription, currentIdentity);
31
+
32
+ currentIdentity = identity;
33
+
34
+ subscription = await client.events.onEndEventFinished(
35
+ (endEventFinished) => {
36
+ node.send({
37
+ payload: endEventFinished
38
+ });
39
+ },
40
+ { identity: currentIdentity },
41
+ );
42
+ });
43
+
44
+ } catch (error) {
45
+ node.error(error);
46
+ }
39
47
 
40
48
  node.on('close', async () => {
41
49
  if (node.engine && node.engine.engineClient && client) {
@@ -58,26 +58,11 @@
58
58
  Waiting for external tasks that correspond to the `Topic` configured in
59
59
  the connected ProcessCube Engine for processing.
60
60
 
61
- ## Configs
62
-
63
- : name (string) : The name of the node
64
- : engine (string) : The ProcessCube Engine to connect to
65
- : topic (string) : The topic of the external task
66
- : workerConfig (object) : The configuration for the worker
67
-
68
- ### workerConfig
69
-
70
- - workerId (string): The id of the worker
71
- - lockDuration (number): The duration in milliseconds the external task is locked for execution
72
- - maxTasks (number): The maximum number of tasks that can be fetched at once
73
- - longpollingTimeout (number): The duration in milliseconds the external task is locked for execution
74
- - payloadFilter (Req-Expression): The filter for the payload of the external task
75
-
76
61
  ## Outputs
77
62
 
78
63
  : payload (string) : The payload the external task was started with.
79
64
  : task (object) : The external task object
80
- : flowNodeInstanceId (string) : The unique identifier of the external task, which is needed to complete the task
65
+ : flowNodeInstanceId : The unique identifier of the external task, which is needed to complete the task
81
66
 
82
67
  ### Details
83
68
 
@@ -109,14 +109,8 @@ module.exports = function (RED) {
109
109
  });
110
110
  };
111
111
 
112
- let options = {};
113
-
114
- if (!!config.workerConfig) {
115
- options = RED.util.evaluateNodeProperty(config.workerConfig, 'json', node);
116
- }
117
-
118
112
  client.externalTasks
119
- .subscribeToExternalTaskTopic(config.topic, etwCallback, options)
113
+ .subscribeToExternalTaskTopic(config.topic, etwCallback, RED.util.evaluateNodeProperty(config.workerConfig, 'json', node))
120
114
  .then(async (externalTaskWorker) => {
121
115
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
122
116
 
@@ -142,8 +136,7 @@ module.exports = function (RED) {
142
136
  showStatus(node, Object.keys(started_external_tasks).length);
143
137
  break;
144
138
  default:
145
- // reduce noise error logs
146
- // node.error(`Worker error ${errorType}: ${error.message}`);
139
+ node.error(`Worker error ${errorType}: ${error.message}`);
147
140
  break;
148
141
  }
149
142
  });
@@ -71,22 +71,6 @@
71
71
  "info": "",
72
72
  "env": []
73
73
  },
74
- {
75
- "id": "76c047e0d8770a20",
76
- "type": "tab",
77
- "label": "Other Events",
78
- "disabled": false,
79
- "info": "",
80
- "env": []
81
- },
82
- {
83
- "id": "2766c40d84283368",
84
- "type": "tab",
85
- "label": "Placeholder",
86
- "disabled": false,
87
- "info": "",
88
- "env": []
89
- },
90
74
  {
91
75
  "id": "4c59118134081e05",
92
76
  "type": "group",
@@ -257,7 +241,7 @@
257
241
  "fc23f271b106648f"
258
242
  ],
259
243
  "x": 34,
260
- "y": 259,
244
+ "y": 239,
261
245
  "w": 652,
262
246
  "h": 202
263
247
  },
@@ -484,9 +468,9 @@
484
468
  "h": 142
485
469
  },
486
470
  {
487
- "id": "865723b71ced9418",
471
+ "id": "3f3c01daebb2d215",
488
472
  "type": "group",
489
- "z": "76c047e0d8770a20",
473
+ "z": "fd3c725340de4f74",
490
474
  "style": {
491
475
  "stroke": "#999999",
492
476
  "stroke-opacity": "1",
@@ -497,36 +481,14 @@
497
481
  "color": "#a4a4a4"
498
482
  },
499
483
  "nodes": [
500
- "930624edc6169c55",
501
- "2f2ec1cc0213eab5",
502
- "bde205e77cd20558"
484
+ "2fadb4c4667ecaf2",
485
+ "93331783b7ef3fc5",
486
+ "bc26f9821540f097",
487
+ "cc3fb9c2cb0edd3a"
503
488
  ],
504
489
  "x": 34,
505
- "y": 39,
506
- "w": 502,
507
- "h": 142
508
- },
509
- {
510
- "id": "9081b057a931f0cf",
511
- "type": "group",
512
- "z": "2766c40d84283368",
513
- "style": {
514
- "stroke": "#999999",
515
- "stroke-opacity": "1",
516
- "fill": "none",
517
- "fill-opacity": "1",
518
- "label": true,
519
- "label-position": "nw",
520
- "color": "#a4a4a4"
521
- },
522
- "nodes": [
523
- "03ac7bc273197c45",
524
- "bb734a85d4b37728",
525
- "3d03550f7d93bfd3"
526
- ],
527
- "x": 54,
528
- "y": 39,
529
- "w": 422,
490
+ "y": 459,
491
+ "w": 552,
530
492
  "h": 142
531
493
  },
532
494
  {
@@ -549,6 +511,8 @@
549
511
  "name": "Test",
550
512
  "engine": "42e6796dddd9d4db",
551
513
  "topic": "Test",
514
+ "workerConfig": "{}",
515
+ "workerConfigType": "json",
552
516
  "x": 110,
553
517
  "y": 180,
554
518
  "wires": [
@@ -601,6 +565,8 @@
601
565
  "name": "SampleError",
602
566
  "engine": "42e6796dddd9d4db",
603
567
  "topic": "SampleError",
568
+ "workerConfig": "{}",
569
+ "workerConfigType": "json",
604
570
  "x": 130,
605
571
  "y": 360,
606
572
  "wires": [
@@ -1186,7 +1152,7 @@
1186
1152
  "query": "payload",
1187
1153
  "query_type": "msg",
1188
1154
  "x": 180,
1189
- "y": 420,
1155
+ "y": 400,
1190
1156
  "wires": [
1191
1157
  [
1192
1158
  "8ef39e83173d41e3"
@@ -1207,7 +1173,7 @@
1207
1173
  "finalize": "",
1208
1174
  "libs": [],
1209
1175
  "x": 390,
1210
- "y": 420,
1176
+ "y": 400,
1211
1177
  "wires": [
1212
1178
  [
1213
1179
  "f524b8cc35d56849"
@@ -1224,7 +1190,7 @@
1224
1190
  "result": "payload.result",
1225
1191
  "result_type": "msg",
1226
1192
  "x": 580,
1227
- "y": 420,
1193
+ "y": 400,
1228
1194
  "wires": [
1229
1195
  []
1230
1196
  ]
@@ -1237,7 +1203,7 @@
1237
1203
  "name": "Demo to listen on a new usertask an finish them",
1238
1204
  "info": "",
1239
1205
  "x": 240,
1240
- "y": 300,
1206
+ "y": 280,
1241
1207
  "wires": []
1242
1208
  },
1243
1209
  {
@@ -1252,7 +1218,7 @@
1252
1218
  "query": "{}",
1253
1219
  "query_type": "json",
1254
1220
  "x": 160,
1255
- "y": 360,
1221
+ "y": 340,
1256
1222
  "wires": [
1257
1223
  [
1258
1224
  "f7c7682e3a6adaaa"
@@ -1297,6 +1263,72 @@
1297
1263
  ]
1298
1264
  ]
1299
1265
  },
1266
+ {
1267
+ "id": "2fadb4c4667ecaf2",
1268
+ "type": "usertask-input",
1269
+ "z": "fd3c725340de4f74",
1270
+ "g": "3f3c01daebb2d215",
1271
+ "name": "",
1272
+ "engine": "42e6796dddd9d4db",
1273
+ "query": "{\"flowNodeId\":\"gibt_es_nicht\"}",
1274
+ "query_type": "json",
1275
+ "sendtype": "array",
1276
+ "x": 300,
1277
+ "y": 560,
1278
+ "wires": [
1279
+ [
1280
+ "bc26f9821540f097"
1281
+ ]
1282
+ ]
1283
+ },
1284
+ {
1285
+ "id": "93331783b7ef3fc5",
1286
+ "type": "inject",
1287
+ "z": "fd3c725340de4f74",
1288
+ "g": "3f3c01daebb2d215",
1289
+ "name": "",
1290
+ "props": [],
1291
+ "repeat": "",
1292
+ "crontab": "",
1293
+ "once": false,
1294
+ "onceDelay": 0.1,
1295
+ "topic": "",
1296
+ "x": 130,
1297
+ "y": 560,
1298
+ "wires": [
1299
+ [
1300
+ "2fadb4c4667ecaf2"
1301
+ ]
1302
+ ]
1303
+ },
1304
+ {
1305
+ "id": "bc26f9821540f097",
1306
+ "type": "debug",
1307
+ "z": "fd3c725340de4f74",
1308
+ "g": "3f3c01daebb2d215",
1309
+ "name": "debug 34",
1310
+ "active": true,
1311
+ "tosidebar": true,
1312
+ "console": false,
1313
+ "tostatus": false,
1314
+ "complete": "false",
1315
+ "statusVal": "",
1316
+ "statusType": "auto",
1317
+ "x": 480,
1318
+ "y": 560,
1319
+ "wires": []
1320
+ },
1321
+ {
1322
+ "id": "cc3fb9c2cb0edd3a",
1323
+ "type": "comment",
1324
+ "z": "fd3c725340de4f74",
1325
+ "g": "3f3c01daebb2d215",
1326
+ "name": "Search UserTasks",
1327
+ "info": "",
1328
+ "x": 150,
1329
+ "y": 500,
1330
+ "wires": []
1331
+ },
1300
1332
  {
1301
1333
  "id": "c4f20aefe585bdad",
1302
1334
  "type": "comment",
@@ -1453,7 +1485,7 @@
1453
1485
  "g": "a71a168415778e2c",
1454
1486
  "name": "",
1455
1487
  "engine": "42e6796dddd9d4db",
1456
- "query": "{\"includeXml\":false,\"processDefinitionId\":\"External-Task-Sample_Definition\"}",
1488
+ "query": "{\"includeXml\":false}",
1457
1489
  "query_type": "json",
1458
1490
  "x": 320,
1459
1491
  "y": 140,
@@ -2062,95 +2094,5 @@
2062
2094
  "x": 760,
2063
2095
  "y": 60,
2064
2096
  "wires": []
2065
- },
2066
- {
2067
- "id": "930624edc6169c55",
2068
- "type": "process-event-listener",
2069
- "z": "76c047e0d8770a20",
2070
- "g": "865723b71ced9418",
2071
- "name": "",
2072
- "engine": "42e6796dddd9d4db",
2073
- "processmodel": "External-Task-Sample_Process",
2074
- "eventtype": "starting",
2075
- "query": "{}",
2076
- "query_type": "json",
2077
- "x": 160,
2078
- "y": 140,
2079
- "wires": [
2080
- [
2081
- "2f2ec1cc0213eab5"
2082
- ]
2083
- ]
2084
- },
2085
- {
2086
- "id": "2f2ec1cc0213eab5",
2087
- "type": "debug",
2088
- "z": "76c047e0d8770a20",
2089
- "g": "865723b71ced9418",
2090
- "name": "debug 34",
2091
- "active": true,
2092
- "tosidebar": true,
2093
- "console": false,
2094
- "tostatus": false,
2095
- "complete": "false",
2096
- "statusVal": "",
2097
- "statusType": "auto",
2098
- "x": 430,
2099
- "y": 140,
2100
- "wires": []
2101
- },
2102
- {
2103
- "id": "bde205e77cd20558",
2104
- "type": "comment",
2105
- "z": "76c047e0d8770a20",
2106
- "g": "865723b71ced9418",
2107
- "name": "Hört auf die Events der Processe",
2108
- "info": "",
2109
- "x": 190,
2110
- "y": 80,
2111
- "wires": []
2112
- },
2113
- {
2114
- "id": "03ac7bc273197c45",
2115
- "type": "process-terminate",
2116
- "z": "2766c40d84283368",
2117
- "g": "9081b057a931f0cf",
2118
- "name": "",
2119
- "engine": "42e6796dddd9d4db",
2120
- "x": 170,
2121
- "y": 140,
2122
- "wires": [
2123
- [
2124
- "bb734a85d4b37728"
2125
- ]
2126
- ]
2127
- },
2128
- {
2129
- "id": "bb734a85d4b37728",
2130
- "type": "debug",
2131
- "z": "2766c40d84283368",
2132
- "g": "9081b057a931f0cf",
2133
- "name": "debug 35",
2134
- "active": true,
2135
- "tosidebar": true,
2136
- "console": false,
2137
- "tostatus": false,
2138
- "complete": "false",
2139
- "statusVal": "",
2140
- "statusType": "auto",
2141
- "x": 370,
2142
- "y": 140,
2143
- "wires": []
2144
- },
2145
- {
2146
- "id": "3d03550f7d93bfd3",
2147
- "type": "comment",
2148
- "z": "2766c40d84283368",
2149
- "g": "9081b057a931f0cf",
2150
- "name": "Event for Terminating a Process",
2151
- "info": "",
2152
- "x": 210,
2153
- "y": 80,
2154
- "wires": []
2155
2097
  }
2156
2098
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.5-feature-22f94f-m3eulbpf",
3
+ "version": "1.5.5",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {