Skip to content

Commit 49f35dd

Browse files
committed
fix rpa node in sub flows
1 parent 36f7f4b commit 49f35dd

5 files changed

Lines changed: 22 additions & 19 deletions

File tree

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.2.79",
3+
"version": "1.2.80",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

OpenFlowNodeRED/src/nodered/nodes/amqp_nodes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class amqp_publisher_node {
178178
private connection: amqp_connection;
179179
private _onsignedin: any = null;
180180
private _onsocketclose: any = null;
181-
private payloads: any = {};
181+
static payloads: any = {};
182182
constructor(public config: Iamqp_publisher_node) {
183183
RED.nodes.createNode(this, config);
184184
try {
@@ -234,8 +234,8 @@ export class amqp_publisher_node {
234234
let result: any = {};
235235
let data = msg.data;
236236
if (!NoderedUtil.IsNullEmpty(data._msgid)) {
237-
result = Object.assign(this.payloads[data._msgid], data);
238-
delete this.payloads[data._msgid];
237+
result = Object.assign(amqp_publisher_node.payloads[data._msgid], data);
238+
delete amqp_publisher_node.payloads[data._msgid];
239239
}
240240
result.payload = data.payload;
241241
result.jwt = data.jwt;
@@ -270,7 +270,7 @@ export class amqp_publisher_node {
270270
this.node.status({ fill: "blue", shape: "dot", text: "Sending message ..." });
271271
try {
272272
await NoderedUtil.QueueMessage(this.websocket(), queue, this.localqueue, data, null, expiration);
273-
this.payloads[msg._msgid] = msg;
273+
amqp_publisher_node.payloads[msg._msgid] = msg;
274274
} catch (error) {
275275
data.error = error;
276276
this.node.send([null, data]);

OpenFlowNodeRED/src/nodered/nodes/rpa_nodes.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,11 @@ export class rpa_workflow_node {
183183
}
184184
let command = data.command;
185185
if (command == undefined && data.data != null && data.data.command != null) { command = data.data.command; }
186-
if (correlationId != null && this.messages[correlationId] != null) {
187-
result = Object.assign({}, this.messages[correlationId]);
186+
if (correlationId != null && rpa_workflow_node.messages[correlationId] != null) {
187+
// result = Object.assign({}, this.messages[correlationId]);
188+
result = rpa_workflow_node.messages[correlationId];
188189
if (command == "invokecompleted" || command == "invokefailed" || command == "invokeaborted" || command == "error" || command == "timeout") {
189-
delete this.messages[correlationId];
190+
delete rpa_workflow_node.messages[correlationId];
190191
}
191192
} else {
192193
result.jwt = data.jwt;
@@ -233,7 +234,7 @@ export class rpa_workflow_node {
233234
NoderedUtil.HandleError(this, error, msg);
234235
}
235236
}
236-
messages: any[] = [];
237+
static messages: any[] = [];
237238
async oninput(msg: any) {
238239
try {
239240
this.node.status({});
@@ -255,8 +256,8 @@ export class rpa_workflow_node {
255256
if (!NoderedUtil.IsNullEmpty(msg.killexisting)) { killexisting = msg.killexisting; }
256257
if (!NoderedUtil.IsNullEmpty(msg.killallexisting)) { killallexisting = msg.killallexisting; }
257258

258-
const correlationId = msg.id || Math.random().toString(36).substr(2, 9);
259-
this.messages[correlationId] = msg;
259+
const correlationId = msg._msgid || Math.random().toString(36).substr(2, 9);
260+
rpa_workflow_node.messages[correlationId] = msg;
260261
if (msg.payload == null || typeof msg.payload == "string" || typeof msg.payload == "number") {
261262
msg.payload = { "data": msg.payload };
262263
}
@@ -274,6 +275,7 @@ export class rpa_workflow_node {
274275
killexisting,
275276
killallexisting,
276277
jwt: msg.jwt,
278+
_msgid: msg._msgid,
277279
// Adding expiry to the rpacommand as a timestamp for when the RPA message is expected to timeout from the message queue
278280
// Currently set to 20 seconds into the future
279281
expiry: Math.floor((new Date().getTime()) / 1000) + Config.amqp_message_ttl,
@@ -388,10 +390,11 @@ export class rpa_killworkflows_node {
388390
}
389391
let command = data.command;
390392
if (command == undefined && data.data != null && data.data.command != null) { command = data.data.command; }
391-
if (correlationId != null && this.messages[correlationId] != null) {
392-
result = Object.assign({}, this.messages[correlationId]);
393+
if (correlationId != null && rpa_killworkflows_node.messages[correlationId] != null) {
394+
// result = Object.assign({}, this.messages[correlationId]);
395+
result = rpa_killworkflows_node.messages[correlationId];
393396
if (command == "killallworkflowssuccess" || command == "error" || command == "timeout") {
394-
delete this.messages[correlationId];
397+
delete rpa_killworkflows_node.messages[correlationId];
395398
}
396399
} else {
397400
result.jwt = data.jwt;
@@ -436,7 +439,7 @@ export class rpa_killworkflows_node {
436439
NoderedUtil.HandleError(this, error, msg);
437440
}
438441
}
439-
messages: any[] = [];
442+
static messages: any[] = [];
440443
async oninput(msg: any) {
441444
try {
442445
this.node.status({});
@@ -451,8 +454,8 @@ export class rpa_killworkflows_node {
451454
if (!NoderedUtil.IsNullEmpty(msg.targetid)) { queue = msg.targetid; }
452455
if (queue == "none") queue = "";
453456

454-
const correlationId = msg.id || Math.random().toString(36).substr(2, 9);
455-
this.messages[correlationId] = msg;
457+
const correlationId = msg._msgid || Math.random().toString(36).substr(2, 9);
458+
rpa_killworkflows_node.messages[correlationId] = msg;
456459
// if (msg.payload == null || typeof msg.payload == "string" || typeof msg.payload == "number") {
457460
// msg.payload = { "data": msg.payload };
458461
// }

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.79
1+
1.2.80

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/openflow",
3-
"version": "1.2.79",
3+
"version": "1.2.80",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)