bpmn-elements 16.2.2 → 17.0.0
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/dist/MessageFormatter.js +47 -47
- package/dist/activity/Activity.js +14 -9
- package/package.json +3 -3
- package/src/Api.js +1 -1
- package/src/MessageFormatter.js +49 -53
- package/src/activity/Activity.js +16 -15
- package/src/activity/ActivityExecution.js +2 -2
- package/src/activity/outbound-evaluator.js +1 -1
- package/src/definition/Definition.js +2 -2
- package/src/definition/DefinitionExecution.js +7 -7
- package/src/error/Errors.js +2 -2
- package/src/eventDefinitions/CancelEventDefinition.js +1 -1
- package/src/eventDefinitions/CompensateEventDefinition.js +1 -1
- package/src/eventDefinitions/ConditionalEventDefinition.js +2 -2
- package/src/eventDefinitions/ErrorEventDefinition.js +3 -3
- package/src/eventDefinitions/LinkEventDefinition.js +1 -1
- package/src/eventDefinitions/MessageEventDefinition.js +2 -2
- package/src/eventDefinitions/SignalEventDefinition.js +2 -2
- package/src/eventDefinitions/TimerEventDefinition.js +2 -2
- package/src/events/BoundaryEvent.js +6 -6
- package/src/events/IntermediateCatchEvent.js +1 -1
- package/src/events/StartEvent.js +2 -2
- package/src/flows/MessageFlow.js +1 -1
- package/src/io/InputOutputSpecification.js +2 -2
- package/src/io/Properties.js +4 -4
- package/src/process/Process.js +1 -1
- package/src/process/ProcessExecution.js +8 -8
- package/src/tasks/CallActivity.js +11 -11
- package/src/tasks/LoopCharacteristics.js +1 -1
- package/src/tasks/ReceiveTask.js +2 -2
- package/src/tasks/ScriptTask.js +2 -2
- package/src/tasks/ServiceTask.js +1 -1
- package/src/tasks/SignalTask.js +4 -4
- package/types/types.d.ts +9 -1
package/dist/MessageFormatter.js
CHANGED
|
@@ -10,7 +10,13 @@ var _Errors = require("./error/Errors.js");
|
|
|
10
10
|
var _smqp = require("smqp");
|
|
11
11
|
const kOnMessage = Symbol.for('onMessage');
|
|
12
12
|
const kExecution = Symbol.for('execution');
|
|
13
|
-
|
|
13
|
+
const EXEC_ROUTING_KEY = 'run._formatting.exec';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Message formatter used to enrich an element run message before continuing to the next run message
|
|
17
|
+
* @param {import('types').ElementBase} element
|
|
18
|
+
*/
|
|
19
|
+
function Formatter(element) {
|
|
14
20
|
const {
|
|
15
21
|
id,
|
|
16
22
|
broker,
|
|
@@ -19,16 +25,19 @@ function Formatter(element, formatQ) {
|
|
|
19
25
|
this.id = id;
|
|
20
26
|
this.broker = broker;
|
|
21
27
|
this.logger = logger;
|
|
22
|
-
this.formatQ = formatQ;
|
|
23
28
|
this[kOnMessage] = this._onMessage.bind(this);
|
|
24
29
|
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Format message
|
|
33
|
+
* @param {import('types').ElementBrokerMessage} message
|
|
34
|
+
* @param {CallableFunction} callback
|
|
35
|
+
*/
|
|
25
36
|
Formatter.prototype.format = function format(message, callback) {
|
|
26
37
|
const correlationId = this._runId = (0, _shared.getUniqueId)(message.fields.routingKey);
|
|
27
38
|
const consumerTag = '_formatter-' + correlationId;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
routingKey: '_formatting.exec'
|
|
31
|
-
}, {}, {
|
|
39
|
+
const broker = this.broker;
|
|
40
|
+
broker.publish('format', EXEC_ROUTING_KEY, {}, {
|
|
32
41
|
correlationId,
|
|
33
42
|
persistent: false
|
|
34
43
|
});
|
|
@@ -37,11 +46,11 @@ Formatter.prototype.format = function format(message, callback) {
|
|
|
37
46
|
formatKey: message.fields.routingKey,
|
|
38
47
|
runMessage: (0, _messageHelper.cloneMessage)(message),
|
|
39
48
|
callback,
|
|
40
|
-
pending:
|
|
49
|
+
pending: new Set(),
|
|
41
50
|
formatted: false,
|
|
42
51
|
executeMessage: null
|
|
43
52
|
};
|
|
44
|
-
|
|
53
|
+
broker.consume('format-run-q', this[kOnMessage], {
|
|
45
54
|
consumerTag,
|
|
46
55
|
prefetch: 100
|
|
47
56
|
});
|
|
@@ -53,41 +62,33 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
53
62
|
pending,
|
|
54
63
|
executeMessage
|
|
55
64
|
} = this[kExecution];
|
|
56
|
-
const asyncFormatting = pending.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const {
|
|
77
|
-
isError,
|
|
78
|
-
message: startMessage
|
|
79
|
-
} = this._popFormatStart(pending, routingKey);
|
|
80
|
-
if (startMessage) startMessage.ack();
|
|
81
|
-
if (isError) {
|
|
82
|
-
return this._complete(message, true);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
this._decorate(message.content);
|
|
86
|
-
this._debug(`format ${message.fields.routingKey} message content with formatter ${routingKey}`);
|
|
87
|
-
if (executeMessage && asyncFormatting && !pending.length) {
|
|
88
|
-
this._complete(message);
|
|
89
|
-
}
|
|
65
|
+
const asyncFormatting = pending.size;
|
|
66
|
+
if (routingKey === EXEC_ROUTING_KEY) {
|
|
67
|
+
if (message.properties.correlationId !== correlationId) return message.ack();
|
|
68
|
+
message.ack();
|
|
69
|
+
if (!asyncFormatting) {
|
|
70
|
+
return this._complete(message);
|
|
71
|
+
}
|
|
72
|
+
this[kExecution].executeMessage = message;
|
|
73
|
+
} else {
|
|
74
|
+
message.ack();
|
|
75
|
+
const endRoutingKey = message.content?.endRoutingKey;
|
|
76
|
+
if (endRoutingKey) {
|
|
77
|
+
this._enrich(message.content);
|
|
78
|
+
pending.add(message);
|
|
79
|
+
return this._debug(`start formatting ${formatKey} message content with formatter ${routingKey}`);
|
|
80
|
+
}
|
|
81
|
+
if (asyncFormatting) {
|
|
82
|
+
const isError = this._popFormatStart(pending, routingKey).isError;
|
|
83
|
+
if (isError) {
|
|
84
|
+
return this._complete(message, true);
|
|
90
85
|
}
|
|
86
|
+
}
|
|
87
|
+
this._enrich(message.content);
|
|
88
|
+
this._debug(`format ${message.fields.routingKey} message content with formatter ${routingKey}`);
|
|
89
|
+
if (executeMessage && !pending.size) {
|
|
90
|
+
this._complete(message);
|
|
91
|
+
}
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
Formatter.prototype._complete = function complete(message, isError) {
|
|
@@ -109,7 +110,7 @@ Formatter.prototype._complete = function complete(message, isError) {
|
|
|
109
110
|
}
|
|
110
111
|
return callback(null, runMessage.content, formatted);
|
|
111
112
|
};
|
|
112
|
-
Formatter.prototype.
|
|
113
|
+
Formatter.prototype._enrich = function enrich(withContent) {
|
|
113
114
|
const content = this[kExecution].runMessage.content;
|
|
114
115
|
for (const key in withContent) {
|
|
115
116
|
switch (key) {
|
|
@@ -134,20 +135,19 @@ Formatter.prototype._decorate = function decorate(withContent) {
|
|
|
134
135
|
}
|
|
135
136
|
};
|
|
136
137
|
Formatter.prototype._popFormatStart = function popFormattingStart(pending, routingKey) {
|
|
137
|
-
for (
|
|
138
|
-
const msg = pending[idx];
|
|
138
|
+
for (const msg of pending) {
|
|
139
139
|
const {
|
|
140
140
|
endRoutingKey,
|
|
141
141
|
errorRoutingKey = '#.error'
|
|
142
142
|
} = msg.content;
|
|
143
143
|
if (endRoutingKey && (0, _smqp.getRoutingKeyPattern)(endRoutingKey).test(routingKey)) {
|
|
144
144
|
this._debug(`completed formatting ${msg.fields.routingKey} message content with formatter ${routingKey}`);
|
|
145
|
-
pending.
|
|
145
|
+
pending.delete(msg);
|
|
146
146
|
return {
|
|
147
147
|
message: msg
|
|
148
148
|
};
|
|
149
149
|
} else if ((0, _smqp.getRoutingKeyPattern)(errorRoutingKey).test(routingKey)) {
|
|
150
|
-
pending.
|
|
150
|
+
pending.delete(msg);
|
|
151
151
|
return {
|
|
152
152
|
isError: true,
|
|
153
153
|
message: msg
|
|
@@ -156,12 +156,7 @@ Object.defineProperties(Activity.prototype, {
|
|
|
156
156
|
get() {
|
|
157
157
|
let formatter = this[kFormatter];
|
|
158
158
|
if (formatter) return formatter;
|
|
159
|
-
|
|
160
|
-
formatter = this[kFormatter] = new _MessageFormatter.Formatter({
|
|
161
|
-
id: this.id,
|
|
162
|
-
broker,
|
|
163
|
-
logger: this.logger
|
|
164
|
-
}, broker.getQueue('format-run-q'));
|
|
159
|
+
formatter = this[kFormatter] = new _MessageFormatter.Formatter(this);
|
|
165
160
|
return formatter;
|
|
166
161
|
}
|
|
167
162
|
},
|
|
@@ -430,7 +425,13 @@ Activity.prototype._discardRun = function discardRun() {
|
|
|
430
425
|
if (!status) return;
|
|
431
426
|
const execution = this[kExec].get('execution');
|
|
432
427
|
if (execution && !execution.completed) return;
|
|
428
|
+
let discardRoutingKey = 'run.discard';
|
|
433
429
|
switch (status) {
|
|
430
|
+
case 'executed':
|
|
431
|
+
{
|
|
432
|
+
discardRoutingKey = 'run.discarded';
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
434
435
|
case 'end':
|
|
435
436
|
case 'executing':
|
|
436
437
|
case 'error':
|
|
@@ -442,7 +443,9 @@ Activity.prototype._discardRun = function discardRun() {
|
|
|
442
443
|
if (this.extensions) this.extensions.deactivate((0, _messageHelper.cloneMessage)(stateMessage));
|
|
443
444
|
const broker = this.broker;
|
|
444
445
|
broker.getQueue('run-q').purge();
|
|
445
|
-
broker.publish('run',
|
|
446
|
+
broker.publish('run', discardRoutingKey, (0, _messageHelper.cloneContent)(stateMessage.content), {
|
|
447
|
+
correlationId: stateMessage.properties.correlationId
|
|
448
|
+
});
|
|
446
449
|
this[kConsuming] = true;
|
|
447
450
|
this._consumeRunQ();
|
|
448
451
|
};
|
|
@@ -609,9 +612,11 @@ Activity.prototype._onRunMessage = function onRunMessage(routingKey, message, me
|
|
|
609
612
|
const preStatus = this.status;
|
|
610
613
|
this.status = 'formatting';
|
|
611
614
|
return this.formatter.format(message, (err, formattedContent, formatted) => {
|
|
612
|
-
if (err) return this.emitFatal(err, message.content);
|
|
613
|
-
if (formatted) message.content = formattedContent;
|
|
614
615
|
this.status = preStatus;
|
|
616
|
+
if (err) {
|
|
617
|
+
return this.emitFatal(err, message.content);
|
|
618
|
+
}
|
|
619
|
+
if (formatted) message.content = formattedContent;
|
|
615
620
|
this._continueRunMessage(routingKey, message, messageProperties);
|
|
616
621
|
});
|
|
617
622
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-elements",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "Executable workflow elements based on BPMN 2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
"mocha": "^11.0.1",
|
|
99
99
|
"mocha-cakes-2": "^3.3.0",
|
|
100
100
|
"moddle-context-serializer": "^4.2.1",
|
|
101
|
-
"nock": "^
|
|
101
|
+
"nock": "^14.0.0",
|
|
102
102
|
"prettier": "^3.2.5",
|
|
103
103
|
"texample": "^0.0.6"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@0dep/piso": "^2.4.0",
|
|
107
|
-
"smqp": "^9.0.
|
|
107
|
+
"smqp": "^9.0.6"
|
|
108
108
|
}
|
|
109
109
|
}
|
package/src/Api.js
CHANGED
package/src/MessageFormatter.js
CHANGED
|
@@ -6,42 +6,43 @@ import { getRoutingKeyPattern } from 'smqp';
|
|
|
6
6
|
const kOnMessage = Symbol.for('onMessage');
|
|
7
7
|
const kExecution = Symbol.for('execution');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const EXEC_ROUTING_KEY = 'run._formatting.exec';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Message formatter used to enrich an element run message before continuing to the next run message
|
|
13
|
+
* @param {import('types').ElementBase} element
|
|
14
|
+
*/
|
|
15
|
+
export function Formatter(element) {
|
|
10
16
|
const { id, broker, logger } = element;
|
|
11
17
|
this.id = id;
|
|
12
18
|
this.broker = broker;
|
|
13
19
|
this.logger = logger;
|
|
14
|
-
this.formatQ = formatQ;
|
|
15
20
|
this[kOnMessage] = this._onMessage.bind(this);
|
|
16
21
|
}
|
|
17
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Format message
|
|
25
|
+
* @param {import('types').ElementBrokerMessage} message
|
|
26
|
+
* @param {CallableFunction} callback
|
|
27
|
+
*/
|
|
18
28
|
Formatter.prototype.format = function format(message, callback) {
|
|
19
29
|
const correlationId = (this._runId = getUniqueId(message.fields.routingKey));
|
|
20
30
|
const consumerTag = '_formatter-' + correlationId;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
routingKey: '_formatting.exec',
|
|
26
|
-
},
|
|
27
|
-
{},
|
|
28
|
-
{
|
|
29
|
-
correlationId,
|
|
30
|
-
persistent: false,
|
|
31
|
-
},
|
|
32
|
-
);
|
|
31
|
+
const broker = this.broker;
|
|
32
|
+
|
|
33
|
+
broker.publish('format', EXEC_ROUTING_KEY, {}, { correlationId, persistent: false });
|
|
33
34
|
|
|
34
35
|
this[kExecution] = {
|
|
35
36
|
correlationId,
|
|
36
37
|
formatKey: message.fields.routingKey,
|
|
37
38
|
runMessage: cloneMessage(message),
|
|
38
39
|
callback,
|
|
39
|
-
pending:
|
|
40
|
+
pending: new Set(),
|
|
40
41
|
formatted: false,
|
|
41
42
|
executeMessage: null,
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
broker.consume('format-run-q', this[kOnMessage], {
|
|
45
46
|
consumerTag,
|
|
46
47
|
prefetch: 100,
|
|
47
48
|
});
|
|
@@ -49,43 +50,40 @@ Formatter.prototype.format = function format(message, callback) {
|
|
|
49
50
|
|
|
50
51
|
Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
51
52
|
const { formatKey, correlationId, pending, executeMessage } = this[kExecution];
|
|
52
|
-
const asyncFormatting = pending.
|
|
53
|
-
|
|
54
|
-
switch (routingKey) {
|
|
55
|
-
case '_formatting.exec':
|
|
56
|
-
if (message.properties.correlationId !== correlationId) return message.ack();
|
|
57
|
-
if (!asyncFormatting) {
|
|
58
|
-
message.ack();
|
|
59
|
-
return this._complete(message);
|
|
60
|
-
}
|
|
61
|
-
this[kExecution].executeMessage = message;
|
|
62
|
-
break;
|
|
63
|
-
default: {
|
|
64
|
-
message.ack();
|
|
65
|
-
|
|
66
|
-
const endRoutingKey = message.content?.endRoutingKey;
|
|
67
|
-
if (endRoutingKey) {
|
|
68
|
-
this._decorate(message.content);
|
|
69
|
-
pending.push(message);
|
|
70
|
-
return this._debug(`start formatting ${formatKey} message content with formatter ${routingKey}`);
|
|
71
|
-
}
|
|
53
|
+
const asyncFormatting = pending.size;
|
|
72
54
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
if (routingKey === EXEC_ROUTING_KEY) {
|
|
56
|
+
if (message.properties.correlationId !== correlationId) return message.ack();
|
|
57
|
+
message.ack();
|
|
58
|
+
if (!asyncFormatting) {
|
|
59
|
+
return this._complete(message);
|
|
60
|
+
}
|
|
61
|
+
this[kExecution].executeMessage = message;
|
|
62
|
+
} else {
|
|
63
|
+
message.ack();
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
return this._complete(message, true);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
65
|
+
const endRoutingKey = message.content?.endRoutingKey;
|
|
81
66
|
|
|
82
|
-
|
|
83
|
-
this.
|
|
67
|
+
if (endRoutingKey) {
|
|
68
|
+
this._enrich(message.content);
|
|
69
|
+
pending.add(message);
|
|
70
|
+
return this._debug(`start formatting ${formatKey} message content with formatter ${routingKey}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (asyncFormatting) {
|
|
74
|
+
const isError = this._popFormatStart(pending, routingKey).isError;
|
|
84
75
|
|
|
85
|
-
if (
|
|
86
|
-
this._complete(message);
|
|
76
|
+
if (isError) {
|
|
77
|
+
return this._complete(message, true);
|
|
87
78
|
}
|
|
88
79
|
}
|
|
80
|
+
|
|
81
|
+
this._enrich(message.content);
|
|
82
|
+
this._debug(`format ${message.fields.routingKey} message content with formatter ${routingKey}`);
|
|
83
|
+
|
|
84
|
+
if (executeMessage && !pending.size) {
|
|
85
|
+
this._complete(message);
|
|
86
|
+
}
|
|
89
87
|
}
|
|
90
88
|
};
|
|
91
89
|
|
|
@@ -106,7 +104,7 @@ Formatter.prototype._complete = function complete(message, isError) {
|
|
|
106
104
|
return callback(null, runMessage.content, formatted);
|
|
107
105
|
};
|
|
108
106
|
|
|
109
|
-
Formatter.prototype.
|
|
107
|
+
Formatter.prototype._enrich = function enrich(withContent) {
|
|
110
108
|
const content = this[kExecution].runMessage.content;
|
|
111
109
|
for (const key in withContent) {
|
|
112
110
|
switch (key) {
|
|
@@ -131,16 +129,14 @@ Formatter.prototype._decorate = function decorate(withContent) {
|
|
|
131
129
|
};
|
|
132
130
|
|
|
133
131
|
Formatter.prototype._popFormatStart = function popFormattingStart(pending, routingKey) {
|
|
134
|
-
for (
|
|
135
|
-
const msg = pending[idx];
|
|
132
|
+
for (const msg of pending) {
|
|
136
133
|
const { endRoutingKey, errorRoutingKey = '#.error' } = msg.content;
|
|
137
|
-
|
|
138
134
|
if (endRoutingKey && getRoutingKeyPattern(endRoutingKey).test(routingKey)) {
|
|
139
135
|
this._debug(`completed formatting ${msg.fields.routingKey} message content with formatter ${routingKey}`);
|
|
140
|
-
pending.
|
|
136
|
+
pending.delete(msg);
|
|
141
137
|
return { message: msg };
|
|
142
138
|
} else if (getRoutingKeyPattern(errorRoutingKey).test(routingKey)) {
|
|
143
|
-
pending.
|
|
139
|
+
pending.delete(msg);
|
|
144
140
|
return { isError: true, message: msg };
|
|
145
141
|
}
|
|
146
142
|
}
|
package/src/activity/Activity.js
CHANGED
|
@@ -143,15 +143,7 @@ Object.defineProperties(Activity.prototype, {
|
|
|
143
143
|
let formatter = this[kFormatter];
|
|
144
144
|
if (formatter) return formatter;
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
formatter = this[kFormatter] = new Formatter(
|
|
148
|
-
{
|
|
149
|
-
id: this.id,
|
|
150
|
-
broker,
|
|
151
|
-
logger: this.logger,
|
|
152
|
-
},
|
|
153
|
-
broker.getQueue('format-run-q'),
|
|
154
|
-
);
|
|
146
|
+
formatter = this[kFormatter] = new Formatter(this);
|
|
155
147
|
return formatter;
|
|
156
148
|
},
|
|
157
149
|
},
|
|
@@ -430,7 +422,12 @@ Activity.prototype._discardRun = function discardRun() {
|
|
|
430
422
|
const execution = this[kExec].get('execution');
|
|
431
423
|
if (execution && !execution.completed) return;
|
|
432
424
|
|
|
425
|
+
let discardRoutingKey = 'run.discard';
|
|
433
426
|
switch (status) {
|
|
427
|
+
case 'executed': {
|
|
428
|
+
discardRoutingKey = 'run.discarded';
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
434
431
|
case 'end':
|
|
435
432
|
case 'executing':
|
|
436
433
|
case 'error':
|
|
@@ -442,10 +439,11 @@ Activity.prototype._discardRun = function discardRun() {
|
|
|
442
439
|
|
|
443
440
|
const stateMessage = this[kStateMessage];
|
|
444
441
|
if (this.extensions) this.extensions.deactivate(cloneMessage(stateMessage));
|
|
442
|
+
|
|
445
443
|
const broker = this.broker;
|
|
446
444
|
broker.getQueue('run-q').purge();
|
|
447
445
|
|
|
448
|
-
broker.publish('run',
|
|
446
|
+
broker.publish('run', discardRoutingKey, cloneContent(stateMessage.content), { correlationId: stateMessage.properties.correlationId });
|
|
449
447
|
this[kConsuming] = true;
|
|
450
448
|
this._consumeRunQ();
|
|
451
449
|
};
|
|
@@ -602,10 +600,13 @@ Activity.prototype._onRunMessage = function onRunMessage(routingKey, message, me
|
|
|
602
600
|
|
|
603
601
|
const preStatus = this.status;
|
|
604
602
|
this.status = 'formatting';
|
|
603
|
+
|
|
605
604
|
return this.formatter.format(message, (err, formattedContent, formatted) => {
|
|
606
|
-
if (err) return this.emitFatal(err, message.content);
|
|
607
|
-
if (formatted) message.content = formattedContent;
|
|
608
605
|
this.status = preStatus;
|
|
606
|
+
if (err) {
|
|
607
|
+
return this.emitFatal(err, message.content);
|
|
608
|
+
}
|
|
609
|
+
if (formatted) message.content = formattedContent;
|
|
609
610
|
this._continueRunMessage(routingKey, message, messageProperties);
|
|
610
611
|
});
|
|
611
612
|
};
|
|
@@ -700,7 +701,7 @@ Activity.prototype._continueRunMessage = function continueRunMessage(routingKey,
|
|
|
700
701
|
...content,
|
|
701
702
|
error: isRedelivered ? makeErrorFromMessage(message) : content.error,
|
|
702
703
|
},
|
|
703
|
-
{ correlationId }
|
|
704
|
+
{ correlationId }
|
|
704
705
|
);
|
|
705
706
|
break;
|
|
706
707
|
}
|
|
@@ -819,7 +820,7 @@ Activity.prototype._doRunLeave = function doRunLeave(message, isDiscarded, onOut
|
|
|
819
820
|
cloneContent(content, {
|
|
820
821
|
...(outbound.length && { outbound }),
|
|
821
822
|
}),
|
|
822
|
-
{ correlationId }
|
|
823
|
+
{ correlationId }
|
|
823
824
|
);
|
|
824
825
|
|
|
825
826
|
onOutbound();
|
|
@@ -891,7 +892,7 @@ Activity.prototype._publishRunOutbound = function publishRunOutbound(outboundFlo
|
|
|
891
892
|
sequenceId: getUniqueId(`${flowId}_${action}`),
|
|
892
893
|
...(discardSequence && { discardSequence: discardSequence.slice() }),
|
|
893
894
|
},
|
|
894
|
-
})
|
|
895
|
+
})
|
|
895
896
|
);
|
|
896
897
|
};
|
|
897
898
|
|
|
@@ -306,7 +306,7 @@ ActivityExecution.prototype._onExecutionDiscarded = function onExecutionDiscarde
|
|
|
306
306
|
ActivityExecution.prototype._publishExecutionCompleted = function publishExecutionCompleted(
|
|
307
307
|
completionType,
|
|
308
308
|
completeContent,
|
|
309
|
-
correlationId
|
|
309
|
+
correlationId
|
|
310
310
|
) {
|
|
311
311
|
this[kCompleted] = true;
|
|
312
312
|
|
|
@@ -317,7 +317,7 @@ ActivityExecution.prototype._publishExecutionCompleted = function publishExecuti
|
|
|
317
317
|
...completeContent,
|
|
318
318
|
state: completionType,
|
|
319
319
|
},
|
|
320
|
-
{ type: completionType, correlationId }
|
|
320
|
+
{ type: completionType, correlationId }
|
|
321
321
|
);
|
|
322
322
|
};
|
|
323
323
|
|
|
@@ -219,7 +219,7 @@ Definition.prototype._shakeProcess = function shakeProcess(shakeBp, startId) {
|
|
|
219
219
|
{
|
|
220
220
|
broker: this.broker,
|
|
221
221
|
exchange: 'event',
|
|
222
|
-
}
|
|
222
|
+
}
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -404,7 +404,7 @@ Definition.prototype._onRunMessage = function onRunMessage(routingKey, message)
|
|
|
404
404
|
...content,
|
|
405
405
|
error: fields.redelivered ? makeErrorFromMessage(message) : content.error,
|
|
406
406
|
},
|
|
407
|
-
{ mandatory: true }
|
|
407
|
+
{ mandatory: true }
|
|
408
408
|
);
|
|
409
409
|
break;
|
|
410
410
|
}
|
|
@@ -439,7 +439,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
|
|
|
439
439
|
executionId: calledFrom.executionId,
|
|
440
440
|
error: content.error,
|
|
441
441
|
},
|
|
442
|
-
{ mandatory: true, type: 'error' }
|
|
442
|
+
{ mandatory: true, type: 'error' }
|
|
443
443
|
);
|
|
444
444
|
} else {
|
|
445
445
|
for (const bp of new Set(this[kProcesses].running)) {
|
|
@@ -502,7 +502,7 @@ DefinitionExecution.prototype._onStopped = function onStopped(message) {
|
|
|
502
502
|
cloneContent(this[kExecuteMessage].content, {
|
|
503
503
|
...message.content,
|
|
504
504
|
}),
|
|
505
|
-
{ type: 'stopped', persistent: false }
|
|
505
|
+
{ type: 'stopped', persistent: false }
|
|
506
506
|
);
|
|
507
507
|
};
|
|
508
508
|
|
|
@@ -563,7 +563,7 @@ DefinitionExecution.prototype._onMessageOutbound = function onMessageOutbound(ro
|
|
|
563
563
|
|
|
564
564
|
this._debug(
|
|
565
565
|
`conveying message from <${source.processId}.${source.id}> to`,
|
|
566
|
-
target.id ? `<${target.processId}.${target.id}>` : `<${target.processId}
|
|
566
|
+
target.id ? `<${target.processId}.${target.id}>` : `<${target.processId}>`
|
|
567
567
|
);
|
|
568
568
|
|
|
569
569
|
const targetProcesses = this.getProcessesById(target.processId);
|
|
@@ -654,7 +654,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
|
|
|
654
654
|
const message = reference?.resolve(executeMessage);
|
|
655
655
|
|
|
656
656
|
this._debug(
|
|
657
|
-
`<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating
|
|
657
|
+
`<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating.`
|
|
658
658
|
);
|
|
659
659
|
|
|
660
660
|
this.getApi().sendApiMessage(
|
|
@@ -669,7 +669,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
|
|
|
669
669
|
message,
|
|
670
670
|
originalMessage: content.message,
|
|
671
671
|
},
|
|
672
|
-
{ delegate: true, type: messageType }
|
|
672
|
+
{ delegate: true, type: messageType }
|
|
673
673
|
);
|
|
674
674
|
|
|
675
675
|
this.broker.publish(
|
|
@@ -678,7 +678,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
|
|
|
678
678
|
this._createMessage({
|
|
679
679
|
message: message && cloneContent(message),
|
|
680
680
|
}),
|
|
681
|
-
{ type: messageType }
|
|
681
|
+
{ type: messageType }
|
|
682
682
|
);
|
|
683
683
|
};
|
|
684
684
|
|
|
@@ -706,7 +706,7 @@ DefinitionExecution.prototype._complete = function complete(completionType, cont
|
|
|
706
706
|
...content,
|
|
707
707
|
state: completionType,
|
|
708
708
|
},
|
|
709
|
-
{ type: completionType, mandatory: completionType === 'error', ...options }
|
|
709
|
+
{ type: completionType, mandatory: completionType === 'error', ...options }
|
|
710
710
|
);
|
|
711
711
|
};
|
|
712
712
|
|
package/src/error/Errors.js
CHANGED
|
@@ -50,13 +50,13 @@ export function makeErrorFromMessage(errorMessage) {
|
|
|
50
50
|
return new ActivityError(
|
|
51
51
|
error.message || error.description,
|
|
52
52
|
error.source,
|
|
53
|
-
error.inner ? error.inner : { code: error.code, name: error.name }
|
|
53
|
+
error.inner ? error.inner : { code: error.code, name: error.name }
|
|
54
54
|
);
|
|
55
55
|
case 'RunError':
|
|
56
56
|
return new RunError(
|
|
57
57
|
error.message || error.description,
|
|
58
58
|
error.source,
|
|
59
|
-
error.inner ? error.inner : { code: error.code, name: error.name }
|
|
59
|
+
error.inner ? error.inner : { code: error.code, name: error.name }
|
|
60
60
|
);
|
|
61
61
|
case 'BpmnError':
|
|
62
62
|
return new BpmnError(error.message || error.description, error, error.source);
|
|
@@ -95,7 +95,7 @@ ConditionalEventDefinition.prototype.evaluateCallback = function evaluateCallbac
|
|
|
95
95
|
return broker.publish(
|
|
96
96
|
'execution',
|
|
97
97
|
'execute.error',
|
|
98
|
-
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
98
|
+
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -106,7 +106,7 @@ ConditionalEventDefinition.prototype.evaluateCallback = function evaluateCallbac
|
|
|
106
106
|
'activity.condition',
|
|
107
107
|
cloneContent(this[kExecuteMessage].content, {
|
|
108
108
|
conditionResult: result,
|
|
109
|
-
})
|
|
109
|
+
})
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
if (!result) return;
|
|
@@ -85,7 +85,7 @@ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessa
|
|
|
85
85
|
exchange: 'execution',
|
|
86
86
|
expectRoutingKey,
|
|
87
87
|
expect: { ...info.message },
|
|
88
|
-
})
|
|
88
|
+
})
|
|
89
89
|
);
|
|
90
90
|
|
|
91
91
|
if (this[kCompleted]) return this._stop();
|
|
@@ -123,7 +123,7 @@ ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessa
|
|
|
123
123
|
'execute.completed',
|
|
124
124
|
cloneContent(executeContent, {
|
|
125
125
|
message: { ...info.message },
|
|
126
|
-
})
|
|
126
|
+
})
|
|
127
127
|
);
|
|
128
128
|
};
|
|
129
129
|
|
|
@@ -178,7 +178,7 @@ ErrorEventDefinition.prototype._catchError = function catchError(routingKey, mes
|
|
|
178
178
|
output: error,
|
|
179
179
|
cancelActivity: true,
|
|
180
180
|
state: 'catch',
|
|
181
|
-
})
|
|
181
|
+
})
|
|
182
182
|
);
|
|
183
183
|
};
|
|
184
184
|
|
|
@@ -124,7 +124,7 @@ MessageEventDefinition.prototype._onCatchMessage = function onCatchMessage(routi
|
|
|
124
124
|
{
|
|
125
125
|
correlationId,
|
|
126
126
|
type,
|
|
127
|
-
}
|
|
127
|
+
}
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
this._complete('caught', message.content.message, { correlationId });
|
|
@@ -171,7 +171,7 @@ MessageEventDefinition.prototype._complete = function complete(verb, output, opt
|
|
|
171
171
|
output,
|
|
172
172
|
state: 'catch',
|
|
173
173
|
}),
|
|
174
|
-
options
|
|
174
|
+
options
|
|
175
175
|
);
|
|
176
176
|
};
|
|
177
177
|
|
|
@@ -128,7 +128,7 @@ SignalEventDefinition.prototype._onCatchMessage = function onCatchMessage(routin
|
|
|
128
128
|
{
|
|
129
129
|
correlationId,
|
|
130
130
|
type,
|
|
131
|
-
}
|
|
131
|
+
}
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
return this._complete(message.content.message, message.properties);
|
|
@@ -164,7 +164,7 @@ SignalEventDefinition.prototype._complete = function complete(output, options) {
|
|
|
164
164
|
output,
|
|
165
165
|
state: 'signal',
|
|
166
166
|
}),
|
|
167
|
-
options
|
|
167
|
+
options
|
|
168
168
|
);
|
|
169
169
|
};
|
|
170
170
|
|
|
@@ -153,7 +153,7 @@ TimerEventDefinition.prototype._onDelegatedApiMessage = function onDelegatedApiM
|
|
|
153
153
|
...content.message,
|
|
154
154
|
},
|
|
155
155
|
}),
|
|
156
|
-
{ correlationId, type }
|
|
156
|
+
{ correlationId, type }
|
|
157
157
|
);
|
|
158
158
|
|
|
159
159
|
return this._onApiMessage(routingKey, message);
|
|
@@ -170,7 +170,7 @@ TimerEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey,
|
|
|
170
170
|
state: 'cancel',
|
|
171
171
|
...(message.content.message && { message: message.content.message }),
|
|
172
172
|
},
|
|
173
|
-
{ correlationId }
|
|
173
|
+
{ correlationId }
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
case 'stop': {
|
|
@@ -105,7 +105,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
|
|
|
105
105
|
return this.broker.publish(
|
|
106
106
|
'execution',
|
|
107
107
|
'execute.completed',
|
|
108
|
-
cloneContent(content, { isDefinitionScope: false, cancelActivity: false })
|
|
108
|
+
cloneContent(content, { isDefinitionScope: false, cancelActivity: false })
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -116,7 +116,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
|
|
|
116
116
|
const attachedTo = this.attachedTo;
|
|
117
117
|
|
|
118
118
|
this.activity.logger.debug(
|
|
119
|
-
`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})
|
|
119
|
+
`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`
|
|
120
120
|
);
|
|
121
121
|
|
|
122
122
|
if (content.isRecovered && !attachedTo.isRunning) {
|
|
@@ -128,7 +128,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
|
|
|
128
128
|
() => {
|
|
129
129
|
attachedTo.getApi({ content: attachedToContent }).discard();
|
|
130
130
|
},
|
|
131
|
-
{ consumerTag: attachedExecuteTag }
|
|
131
|
+
{ consumerTag: attachedExecuteTag }
|
|
132
132
|
);
|
|
133
133
|
} else {
|
|
134
134
|
attachedTo.getApi({ content: attachedToContent }).discard();
|
|
@@ -165,7 +165,7 @@ BoundaryEventBehaviour.prototype._onExpectMessage = function onExpectMessage(_,
|
|
|
165
165
|
noAck: true,
|
|
166
166
|
consumerTag: errorConsumerTag,
|
|
167
167
|
priority: 400,
|
|
168
|
-
}
|
|
168
|
+
}
|
|
169
169
|
);
|
|
170
170
|
};
|
|
171
171
|
|
|
@@ -195,7 +195,7 @@ BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_,
|
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
cloneMessage,
|
|
198
|
-
}
|
|
198
|
+
}
|
|
199
199
|
);
|
|
200
200
|
|
|
201
201
|
const detachContent = cloneContent(content, {
|
|
@@ -215,7 +215,7 @@ BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_,
|
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
consumerTag: `_execution-completed-${executionId}`,
|
|
218
|
-
}
|
|
218
|
+
}
|
|
219
219
|
);
|
|
220
220
|
};
|
|
221
221
|
|
package/src/events/StartEvent.js
CHANGED
|
@@ -64,7 +64,7 @@ StartEventBehaviour.prototype._onApiMessage = function onApiMessage(routingKey,
|
|
|
64
64
|
output: message.content.message,
|
|
65
65
|
state: 'signal',
|
|
66
66
|
}),
|
|
67
|
-
{ correlationId }
|
|
67
|
+
{ correlationId }
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
case 'discard': {
|
|
@@ -97,7 +97,7 @@ StartEventBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMe
|
|
|
97
97
|
{
|
|
98
98
|
correlationId,
|
|
99
99
|
type,
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
return this._onApiMessage(routingKey, message);
|
package/src/flows/MessageFlow.js
CHANGED
|
@@ -80,7 +80,7 @@ MessageFlow.prototype._onSourceEnd = function onSourceEnd({ content }) {
|
|
|
80
80
|
const source = this.source;
|
|
81
81
|
const target = this.target;
|
|
82
82
|
this.logger.debug(
|
|
83
|
-
`<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}
|
|
83
|
+
`<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}>`
|
|
84
84
|
);
|
|
85
85
|
this.broker.publish('event', 'message.outbound', this._createMessageContent(content.message));
|
|
86
86
|
};
|
|
@@ -71,7 +71,7 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
|
|
|
71
71
|
{
|
|
72
72
|
dataObjects: [],
|
|
73
73
|
sources: [],
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
if (!dataObjects.length) {
|
|
@@ -135,7 +135,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
|
|
|
135
135
|
{
|
|
136
136
|
dataObjects: [],
|
|
137
137
|
sources: [],
|
|
138
|
-
}
|
|
138
|
+
}
|
|
139
139
|
);
|
|
140
140
|
|
|
141
141
|
const startRoutingKey = `run.onend.${safeType}`;
|
package/src/io/Properties.js
CHANGED
|
@@ -94,7 +94,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
|
|
|
94
94
|
{ routingKey: startRoutingKey },
|
|
95
95
|
{
|
|
96
96
|
properties: this._getProperties(message),
|
|
97
|
-
}
|
|
97
|
+
}
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -104,7 +104,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
|
|
|
104
104
|
{
|
|
105
105
|
endRoutingKey,
|
|
106
106
|
properties: this._getProperties(message),
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
return read(broker, [...dataInputObjects], (_, responses) => {
|
|
@@ -127,7 +127,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
|
|
|
127
127
|
{ routingKey: startRoutingKey },
|
|
128
128
|
{
|
|
129
129
|
properties: outputProperties,
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -137,7 +137,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
|
|
|
137
137
|
{
|
|
138
138
|
endRoutingKey,
|
|
139
139
|
properties: outputProperties,
|
|
140
|
-
}
|
|
140
|
+
}
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
return write(broker, [...dataOutputObjects], outputProperties, (_, responses) => {
|
package/src/process/Process.js
CHANGED
|
@@ -266,7 +266,7 @@ ProcessExecution.prototype.shake = function shake(fromId) {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
|
-
{ noAck: true, consumerTag: `_shaker-${this.executionId}` }
|
|
269
|
+
{ noAck: true, consumerTag: `_shaker-${this.executionId}` }
|
|
270
270
|
);
|
|
271
271
|
|
|
272
272
|
for (const a of toShake) a.shake();
|
|
@@ -301,7 +301,7 @@ ProcessExecution.prototype.discard = function discard() {
|
|
|
301
301
|
type: this.type,
|
|
302
302
|
executionId: this.executionId,
|
|
303
303
|
},
|
|
304
|
-
{ type: 'discard' }
|
|
304
|
+
{ type: 'discard' }
|
|
305
305
|
);
|
|
306
306
|
};
|
|
307
307
|
|
|
@@ -313,7 +313,7 @@ ProcessExecution.prototype.cancel = function discard() {
|
|
|
313
313
|
type: this.type,
|
|
314
314
|
executionId: this.executionId,
|
|
315
315
|
},
|
|
316
|
-
{ type: 'cancel' }
|
|
316
|
+
{ type: 'cancel' }
|
|
317
317
|
);
|
|
318
318
|
};
|
|
319
319
|
|
|
@@ -689,7 +689,7 @@ ProcessExecution.prototype._onChildCompleted = function onChildCompleted(message
|
|
|
689
689
|
type: this.type,
|
|
690
690
|
executionId: this.executionId,
|
|
691
691
|
},
|
|
692
|
-
{ type: 'cancel' }
|
|
692
|
+
{ type: 'cancel' }
|
|
693
693
|
);
|
|
694
694
|
}
|
|
695
695
|
|
|
@@ -722,7 +722,7 @@ ProcessExecution.prototype._stopExecution = function stopExecution(message) {
|
|
|
722
722
|
...this[kExecuteMessage].content,
|
|
723
723
|
...(message && message.content),
|
|
724
724
|
},
|
|
725
|
-
{ type: 'stopped', persistent: false }
|
|
725
|
+
{ type: 'stopped', persistent: false }
|
|
726
726
|
);
|
|
727
727
|
};
|
|
728
728
|
|
|
@@ -760,7 +760,7 @@ ProcessExecution.prototype._onCancel = function onCancel() {
|
|
|
760
760
|
'transaction.cancel',
|
|
761
761
|
cloneMessage(this[kExecuteMessage], {
|
|
762
762
|
state: 'cancel',
|
|
763
|
-
})
|
|
763
|
+
})
|
|
764
764
|
);
|
|
765
765
|
|
|
766
766
|
for (const msg of running) {
|
|
@@ -817,7 +817,7 @@ ProcessExecution.prototype._delegateApiMessage = function delegateApiMessage(rou
|
|
|
817
817
|
this._debug(`delegated api message was consumed by ${msg.content ? msg.content.executionId : 'unknown'}`);
|
|
818
818
|
}
|
|
819
819
|
},
|
|
820
|
-
{ consumerTag: `_ct-delegate-${correlationId}`, noAck: true }
|
|
820
|
+
{ consumerTag: `_ct-delegate-${correlationId}`, noAck: true }
|
|
821
821
|
);
|
|
822
822
|
|
|
823
823
|
for (const child of this[kElements].children) {
|
|
@@ -858,7 +858,7 @@ ProcessExecution.prototype._complete = function complete(completionType, content
|
|
|
858
858
|
...content,
|
|
859
859
|
state: completionType,
|
|
860
860
|
}),
|
|
861
|
-
{ type: completionType, mandatory: completionType === 'error' }
|
|
861
|
+
{ type: completionType, mandatory: completionType === 'error' }
|
|
862
862
|
);
|
|
863
863
|
};
|
|
864
864
|
|
|
@@ -39,8 +39,8 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
mandatory: true,
|
|
42
|
-
}
|
|
43
|
-
)
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -55,7 +55,7 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
55
55
|
noAck: true,
|
|
56
56
|
consumerTag: `_api-${executionId}`,
|
|
57
57
|
priority: 300,
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
);
|
|
60
60
|
broker.subscribeTmp('api', '#.signal.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
|
|
61
61
|
noAck: true,
|
|
@@ -75,7 +75,7 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
75
75
|
}),
|
|
76
76
|
{
|
|
77
77
|
type: 'call',
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
79
|
);
|
|
80
80
|
};
|
|
81
81
|
|
|
@@ -83,7 +83,7 @@ CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApi
|
|
|
83
83
|
calledElement,
|
|
84
84
|
executeMessage,
|
|
85
85
|
routingKey,
|
|
86
|
-
message
|
|
86
|
+
message
|
|
87
87
|
) {
|
|
88
88
|
if (!message.properties.delegate) return;
|
|
89
89
|
const { content: delegateContent } = message;
|
|
@@ -106,7 +106,7 @@ CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApi
|
|
|
106
106
|
{
|
|
107
107
|
correlationId,
|
|
108
108
|
type: messageType,
|
|
109
|
-
}
|
|
109
|
+
}
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
return this._onApiMessage(calledElement, executeMessage, routingKey, message);
|
|
@@ -129,7 +129,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
|
|
|
129
129
|
}),
|
|
130
130
|
{
|
|
131
131
|
type: 'cancel',
|
|
132
|
-
}
|
|
132
|
+
}
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
case 'signal':
|
|
@@ -143,7 +143,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
|
|
|
143
143
|
}),
|
|
144
144
|
{
|
|
145
145
|
correlationId,
|
|
146
|
-
}
|
|
146
|
+
}
|
|
147
147
|
);
|
|
148
148
|
case 'error':
|
|
149
149
|
this._stop(executeContent.executionId);
|
|
@@ -158,8 +158,8 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
|
|
|
158
158
|
{
|
|
159
159
|
mandatory: true,
|
|
160
160
|
correlationId,
|
|
161
|
-
}
|
|
162
|
-
)
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
163
|
);
|
|
164
164
|
case 'discard':
|
|
165
165
|
return this.broker.publish(
|
|
@@ -171,7 +171,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
|
|
|
171
171
|
}),
|
|
172
172
|
{
|
|
173
173
|
type: 'discard',
|
|
174
|
-
}
|
|
174
|
+
}
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
};
|
|
@@ -326,7 +326,7 @@ Characteristics.prototype.subscribe = function subscribe(onIterationCompleteMess
|
|
|
326
326
|
`activity.*.${this.parentExecutionId}`,
|
|
327
327
|
this.onApiMessage,
|
|
328
328
|
{ noAck: true, consumerTag: '_api-multi-instance-tag' },
|
|
329
|
-
{ priority: 400 }
|
|
329
|
+
{ priority: 400 }
|
|
330
330
|
);
|
|
331
331
|
this.broker.subscribeTmp('execution', 'execute.*', onComplete, {
|
|
332
332
|
noAck: true,
|
package/src/tasks/ReceiveTask.js
CHANGED
|
@@ -163,7 +163,7 @@ ReceiveTaskExecution.prototype._setupMessageHandling = function setupMessageHand
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
noAck: true,
|
|
166
|
-
}
|
|
166
|
+
}
|
|
167
167
|
);
|
|
168
168
|
broker.subscribeTmp('api', `activity.stop.${executionId}`, this._onStopApiMessage.bind(this), {
|
|
169
169
|
noAck: true,
|
|
@@ -180,7 +180,7 @@ ReceiveTaskExecution.prototype._setupMessageHandling = function setupMessageHand
|
|
|
180
180
|
},
|
|
181
181
|
{
|
|
182
182
|
noAck: true,
|
|
183
|
-
}
|
|
183
|
+
}
|
|
184
184
|
);
|
|
185
185
|
};
|
|
186
186
|
|
package/src/tasks/ScriptTask.js
CHANGED
|
@@ -35,7 +35,7 @@ ScriptTaskBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
35
35
|
if (!script) {
|
|
36
36
|
return activity.emitFatal(
|
|
37
37
|
new ActivityError(`Script format ${scriptFormat} is unsupported or was not registered for <${activity.id}>`, executeMessage),
|
|
38
|
-
executeContent
|
|
38
|
+
executeContent
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ ScriptTaskBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
47
47
|
return activity.broker.publish(
|
|
48
48
|
'execution',
|
|
49
49
|
'execute.error',
|
|
50
|
-
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
50
|
+
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
return activity.broker.publish('execution', 'execute.completed', cloneContent(executeContent, { output }));
|
package/src/tasks/ServiceTask.js
CHANGED
|
@@ -41,7 +41,7 @@ ServiceTaskBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
41
41
|
return broker.publish(
|
|
42
42
|
'execution',
|
|
43
43
|
'execute.error',
|
|
44
|
-
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
44
|
+
cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
package/src/tasks/SignalTask.js
CHANGED
|
@@ -59,7 +59,7 @@ SignalTaskBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMe
|
|
|
59
59
|
{
|
|
60
60
|
correlationId,
|
|
61
61
|
type: messageType,
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
return this._onApiMessage(executeMessage, routingKey, message);
|
|
@@ -82,7 +82,7 @@ SignalTaskBehaviour.prototype._onApiMessage = function onApiMessage(executeMessa
|
|
|
82
82
|
}),
|
|
83
83
|
{
|
|
84
84
|
correlationId,
|
|
85
|
-
}
|
|
85
|
+
}
|
|
86
86
|
);
|
|
87
87
|
case 'error':
|
|
88
88
|
this._stop(executeContent.executionId);
|
|
@@ -97,8 +97,8 @@ SignalTaskBehaviour.prototype._onApiMessage = function onApiMessage(executeMessa
|
|
|
97
97
|
{
|
|
98
98
|
mandatory: true,
|
|
99
99
|
correlationId,
|
|
100
|
-
}
|
|
101
|
-
)
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
102
|
);
|
|
103
103
|
case 'discard':
|
|
104
104
|
this._stop(executeContent.executionId);
|
package/types/types.d.ts
CHANGED
|
@@ -699,6 +699,13 @@ declare interface IScripts {
|
|
|
699
699
|
getScript(language: string, identifier: { id: string; [x: string]: any }): Script;
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
+
declare class MessageFormatter {
|
|
703
|
+
id: string;
|
|
704
|
+
broker: Broker;
|
|
705
|
+
logger: ILogger;
|
|
706
|
+
format(message: MessageElement, callback: CallableFunction): void;
|
|
707
|
+
}
|
|
708
|
+
|
|
702
709
|
declare class Activity extends Element<Activity> {
|
|
703
710
|
constructor(behaviour: IActivityBehaviour, activityDef: SerializableElement, context: ContextInstance);
|
|
704
711
|
get Behaviour(): IActivityBehaviour;
|
|
@@ -721,6 +728,7 @@ declare class Activity extends Element<Activity> {
|
|
|
721
728
|
get triggeredByEvent(): boolean;
|
|
722
729
|
get attachedTo(): Activity;
|
|
723
730
|
get eventDefinitions(): EventDefinition[];
|
|
731
|
+
get formatter(): MessageFormatter;
|
|
724
732
|
/** Parent element process or sub process reference */
|
|
725
733
|
get parentElement(): Process | Activity;
|
|
726
734
|
activate(): void;
|
|
@@ -733,7 +741,7 @@ declare class Activity extends Element<Activity> {
|
|
|
733
741
|
evaluateOutbound(
|
|
734
742
|
fromMessage: ElementBrokerMessage,
|
|
735
743
|
discardRestAtTake: boolean,
|
|
736
|
-
callback: (err: Error, evaluationResult: any) => void
|
|
744
|
+
callback: (err: Error, evaluationResult: any) => void
|
|
737
745
|
): void;
|
|
738
746
|
getState(): ActivityState | undefined;
|
|
739
747
|
}
|