bpmn-elements 8.2.4 → 9.1.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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +5 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/Tracker.js +89 -0
- package/dist/{src/activity → activity}/Activity.js +109 -120
- package/dist/{src/activity → activity}/ActivityExecution.js +28 -32
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +64 -59
- package/dist/{src/definition → definition}/DefinitionExecution.js +68 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/eventDefinitions/CancelEventDefinition.js +127 -0
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +64 -52
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +24 -16
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +15 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +39 -25
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +14 -22
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +3 -4
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +44 -40
- package/dist/{src/process → process}/ProcessExecution.js +169 -78
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +19 -19
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +31 -31
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +2 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/Tracker.js +73 -0
- package/src/activity/Activity.js +106 -114
- package/src/activity/ActivityExecution.js +28 -32
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +65 -64
- package/src/definition/DefinitionExecution.js +71 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +32 -78
- package/src/eventDefinitions/CompensateEventDefinition.js +58 -52
- package/src/eventDefinitions/ConditionalEventDefinition.js +25 -17
- package/src/eventDefinitions/ErrorEventDefinition.js +15 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +34 -24
- package/src/events/EndEvent.js +3 -3
- package/src/events/IntermediateCatchEvent.js +3 -3
- package/src/events/IntermediateThrowEvent.js +3 -3
- package/src/events/StartEvent.js +8 -10
- package/src/flows/Association.js +14 -26
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +3 -4
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +45 -41
- package/src/process/ProcessExecution.js +167 -79
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +19 -20
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +520 -0
- package/dist/src/eventDefinitions/CancelEventDefinition.js +0 -184
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /package/dist/{src/shared.js → shared.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {brokerSafeId} from '../shared';
|
|
2
|
-
import {cloneContent, cloneMessage, shiftParent} from '../messageHelper';
|
|
1
|
+
import {brokerSafeId} from '../shared.js';
|
|
2
|
+
import {cloneContent, cloneMessage, shiftParent} from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
const kCompleted = Symbol.for('completed');
|
|
5
5
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
@@ -20,29 +20,33 @@ export default function CompensateEventDefinition(activity, eventDefinition, con
|
|
|
20
20
|
|
|
21
21
|
if (!isThrowing) {
|
|
22
22
|
this[kCompleted] = false;
|
|
23
|
-
this[kAssociations] = context.getOutboundAssociations(id)
|
|
23
|
+
this[kAssociations] = context.getOutboundAssociations(id);
|
|
24
24
|
const messageQueueName = `${reference.referenceType}-${brokerSafeId(id)}-q`;
|
|
25
25
|
this[kMessageQ] = broker.assertQueue(messageQueueName, {autoDelete: false, durable: true});
|
|
26
|
+
this[kCompensateQ] = broker.assertQueue('compensate-q', {autoDelete: false, durable: true});
|
|
26
27
|
broker.bindQueue(messageQueueName, 'api', `*.${reference.referenceType}.#`, {durable: true, priority: 400});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(proto, 'executionId', {
|
|
31
|
+
Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
|
|
33
32
|
get() {
|
|
34
33
|
const message = this[kExecuteMessage];
|
|
35
34
|
return message && message.content.executionId;
|
|
36
35
|
},
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
CompensateEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
40
39
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
CompensateEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
44
43
|
this[kExecuteMessage] = executeMessage;
|
|
45
44
|
this[kCompleted] = false;
|
|
45
|
+
if (executeMessage.fields.routingKey === 'execute.compensating') {
|
|
46
|
+
this._debug('resumed at compensating');
|
|
47
|
+
this[kCompleted] = true;
|
|
48
|
+
return this._compensate();
|
|
49
|
+
}
|
|
46
50
|
|
|
47
51
|
const executeContent = executeMessage.content;
|
|
48
52
|
const {executionId, parent} = executeContent;
|
|
@@ -50,18 +54,13 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
50
54
|
this._debug('expect compensate');
|
|
51
55
|
|
|
52
56
|
const broker = this.broker;
|
|
57
|
+
broker.cancel('_convey-messages');
|
|
53
58
|
broker.assertExchange('compensate', 'topic');
|
|
54
|
-
this[kCompensateQ] = broker.assertQueue('compensate-q', {durable: true, autoDelete: false});
|
|
55
59
|
broker.subscribeTmp('compensate', 'execute.#', this._onCollect.bind(this), {
|
|
56
60
|
noAck: true,
|
|
57
61
|
consumerTag: '_oncollect-messages',
|
|
58
62
|
});
|
|
59
63
|
|
|
60
|
-
broker.publish('execution', 'execute.detach', cloneContent(executeContent, {
|
|
61
|
-
sourceExchange: 'execution',
|
|
62
|
-
bindExchange: 'compensate',
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
64
|
this[kMessageQ].consume(this._onCompensateApiMessage.bind(this), {
|
|
66
65
|
noAck: true,
|
|
67
66
|
consumerTag: `_oncompensate-${executionId}`,
|
|
@@ -69,27 +68,24 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
69
68
|
|
|
70
69
|
if (this[kCompleted]) return;
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
broker.subscribeTmp('api', `activity.#.${executionId}`, onApiMessage, {
|
|
71
|
+
broker.subscribeTmp('api', `activity.#.${parent.executionId}#`, this._onApiMessage.bind(this), {
|
|
74
72
|
noAck: true,
|
|
75
73
|
consumerTag: `_api-${executionId}`,
|
|
76
74
|
});
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
broker.publish('execution', 'execute.detach', cloneContent(executeContent, {
|
|
77
|
+
sourceExchange: 'execution',
|
|
80
78
|
bindExchange: 'compensate',
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
broker.publish('event', 'activity.detach', detachContent);
|
|
79
|
+
expect: 'compensate',
|
|
80
|
+
}));
|
|
85
81
|
};
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
CompensateEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
88
84
|
const executeContent = executeMessage.content;
|
|
89
|
-
const {
|
|
85
|
+
const {parent} = executeContent;
|
|
90
86
|
const parentExecutionId = parent && parent.executionId;
|
|
91
87
|
|
|
92
|
-
this.logger.debug(`<${
|
|
88
|
+
this.logger.debug(`<${parentExecutionId} (${this.id})> throw compensate`);
|
|
93
89
|
|
|
94
90
|
const broker = this.broker;
|
|
95
91
|
const throwContent = cloneContent(executeContent, {
|
|
@@ -102,8 +98,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
102
98
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
|
|
103
99
|
};
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
CompensateEventDefinition.prototype._onCollect = function onCollect(routingKey, message) {
|
|
107
102
|
switch (routingKey) {
|
|
108
103
|
case 'execute.error':
|
|
109
104
|
case 'execute.completed': {
|
|
@@ -112,68 +107,79 @@ proto._onCollect = function onCollect(routingKey, message) {
|
|
|
112
107
|
}
|
|
113
108
|
};
|
|
114
109
|
|
|
115
|
-
|
|
116
|
-
const output = message.content.message;
|
|
110
|
+
CompensateEventDefinition.prototype._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
|
|
117
111
|
this[kCompleted] = true;
|
|
112
|
+
const output = message.content.message;
|
|
113
|
+
const broker = this.broker;
|
|
114
|
+
const executeContent = this[kExecuteMessage].content;
|
|
118
115
|
|
|
119
|
-
this.
|
|
116
|
+
this._stopCollect();
|
|
120
117
|
|
|
121
118
|
this._debug('caught compensate event');
|
|
122
|
-
|
|
123
|
-
const executeContent = this[kExecuteMessage].content;
|
|
119
|
+
|
|
124
120
|
const catchContent = cloneContent(executeContent, {
|
|
125
121
|
message: {...output},
|
|
126
122
|
executionId: executeContent.parent.executionId,
|
|
127
123
|
});
|
|
128
124
|
catchContent.parent = shiftParent(catchContent.parent);
|
|
129
125
|
|
|
126
|
+
this[kCompensateQ].queueMessage({routingKey: 'execute.compensated'}, cloneContent(executeContent));
|
|
127
|
+
|
|
128
|
+
broker.publish('execution', 'execute.compensating', cloneContent(executeContent, {message: {...output}}));
|
|
130
129
|
broker.publish('event', 'activity.catch', catchContent, {type: 'catch'});
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
compensateQ.consume(this._onCollected.bind(this), {noAck: true, consumerTag: '_convey-messages'});
|
|
131
|
+
return this._compensate();
|
|
132
|
+
};
|
|
135
133
|
|
|
136
|
-
|
|
134
|
+
CompensateEventDefinition.prototype._compensate = function compensate() {
|
|
135
|
+
return this[kCompensateQ].consume(this._onCollected.bind(this), {noAck: true, consumerTag: '_convey-messages'});
|
|
136
|
+
};
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
CompensateEventDefinition.prototype._onCollected = function onCollected(routingKey, message) {
|
|
139
|
+
if (routingKey === 'execute.compensated') {
|
|
140
|
+
const broker = this.broker;
|
|
141
|
+
broker.cancel('_convey-messages');
|
|
142
|
+
return this.broker.publish('execution', 'execute.completed', cloneContent(message.content, {cancelActivity: false}));
|
|
141
143
|
}
|
|
144
|
+
for (const association of this[kAssociations]) association.take(cloneMessage(message));
|
|
142
145
|
};
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
CompensateEventDefinition.prototype._onDiscardApiMessage = function onDiscardApiMessage(routingKey, message) {
|
|
148
|
+
this[kCompleted] = true;
|
|
149
|
+
this._stop();
|
|
150
|
+
this[kCompensateQ].purge();
|
|
151
|
+
for (const association of this[kAssociations]) association.discard(cloneMessage(message));
|
|
152
|
+
return this.broker.publish('execution', 'execute.discard', cloneContent(this[kExecuteMessage].content));
|
|
146
153
|
};
|
|
147
154
|
|
|
148
|
-
|
|
155
|
+
CompensateEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
149
156
|
const messageType = message.properties.type;
|
|
150
|
-
|
|
151
157
|
switch (messageType) {
|
|
152
158
|
case 'compensate': {
|
|
153
159
|
return this._onCompensateApiMessage(routingKey, message);
|
|
154
160
|
}
|
|
155
161
|
case 'discard': {
|
|
156
|
-
this
|
|
157
|
-
this._stop();
|
|
158
|
-
for (const association of this[kAssociations]) association.discard(cloneMessage(message));
|
|
159
|
-
return this.broker.publish('execution', 'execute.discard', cloneContent(this[kExecuteMessage].content));
|
|
162
|
+
return this._onDiscardApiMessage(routingKey, message);
|
|
160
163
|
}
|
|
161
164
|
case 'stop': {
|
|
162
|
-
this._stop();
|
|
163
|
-
break;
|
|
165
|
+
return this._stop();
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
};
|
|
167
169
|
|
|
168
|
-
|
|
170
|
+
CompensateEventDefinition.prototype._stopCollect = function stopCollect() {
|
|
169
171
|
const broker = this.broker, executionId = this.executionId;
|
|
170
172
|
broker.cancel(`_api-${executionId}`);
|
|
171
173
|
broker.cancel(`_oncompensate-${executionId}`);
|
|
172
174
|
broker.cancel('_oncollect-messages');
|
|
173
|
-
broker.cancel('_convey-messages');
|
|
174
175
|
this[kMessageQ].purge();
|
|
175
176
|
};
|
|
176
177
|
|
|
177
|
-
|
|
178
|
+
CompensateEventDefinition.prototype._stop = function stop() {
|
|
179
|
+
this._stopCollect();
|
|
180
|
+
this.broker.cancel('_convey-messages');
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
CompensateEventDefinition.prototype._debug = function debug(msg) {
|
|
178
184
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
179
185
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
2
|
-
import {ActivityError} from '../error/Errors';
|
|
1
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
2
|
+
import {ActivityError} from '../error/Errors.js';
|
|
3
3
|
|
|
4
4
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
5
5
|
|
|
@@ -18,21 +18,19 @@ export default function ConditionalEventDefinition(activity, eventDefinition) {
|
|
|
18
18
|
this.logger = environment.Logger(type.toLowerCase());
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(proto, 'executionId', {
|
|
21
|
+
Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
|
|
24
22
|
get() {
|
|
25
23
|
const message = this[kExecuteMessage];
|
|
26
24
|
return message && message.content.executionId;
|
|
27
25
|
},
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
ConditionalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
31
29
|
this[kExecuteMessage] = executeMessage;
|
|
32
30
|
return this.isWaiting ? this.executeWait(executeMessage) : this.executeCatch(executeMessage);
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
ConditionalEventDefinition.prototype.executeWait = function executeWait(executeMessage) {
|
|
36
34
|
const executeContent = executeMessage.content;
|
|
37
35
|
const {executionId, parent} = executeContent;
|
|
38
36
|
const parentExecutionId = parent.executionId;
|
|
@@ -59,11 +57,13 @@ proto.executeWait = function executeWait(executeMessage) {
|
|
|
59
57
|
broker.publish('event', 'activity.wait', waitContent);
|
|
60
58
|
};
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
ConditionalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
63
61
|
const executeContent = executeMessage.content;
|
|
64
|
-
const {executionId, index} = executeContent;
|
|
62
|
+
const {executionId, index, parent} = executeContent;
|
|
63
|
+
const parentExecutionId = parent.executionId;
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
const broker = this.broker;
|
|
66
|
+
broker.subscribeTmp('api', `activity.#.${executionId}`, this._onCatchApiMessage.bind(this), {
|
|
67
67
|
noAck: true,
|
|
68
68
|
consumerTag: `_api-${executionId}_${index}`,
|
|
69
69
|
});
|
|
@@ -76,9 +76,17 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
76
76
|
priority: 300,
|
|
77
77
|
consumerTag: `_onend-${executionId}_${index}`,
|
|
78
78
|
});
|
|
79
|
+
|
|
80
|
+
const waitContent = cloneContent(executeContent, {
|
|
81
|
+
executionId: parentExecutionId,
|
|
82
|
+
condition: this.condition,
|
|
83
|
+
});
|
|
84
|
+
waitContent.parent = shiftParent(parent);
|
|
85
|
+
|
|
86
|
+
broker.publish('event', 'activity.wait', waitContent);
|
|
79
87
|
};
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
ConditionalEventDefinition.prototype._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
|
|
82
90
|
const messageType = message.properties.type;
|
|
83
91
|
|
|
84
92
|
switch (messageType) {
|
|
@@ -95,7 +103,7 @@ proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
|
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
ConditionalEventDefinition.prototype._evaluateWait = function evaluate(message) {
|
|
99
107
|
const executeMessage = this[kExecuteMessage];
|
|
100
108
|
const broker = this.broker, executeContent = executeMessage.content;
|
|
101
109
|
|
|
@@ -116,13 +124,13 @@ proto._evaluateWait = function evaluate(message) {
|
|
|
116
124
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output}));
|
|
117
125
|
};
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
ConditionalEventDefinition.prototype._stopWait = function stopWait() {
|
|
120
128
|
const broker = this.broker, executionId = this.executionId;
|
|
121
129
|
broker.cancel(`_api-${executionId}`);
|
|
122
130
|
broker.cancel(`_parent-signal-${executionId}`);
|
|
123
131
|
};
|
|
124
132
|
|
|
125
|
-
|
|
133
|
+
ConditionalEventDefinition.prototype._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
|
|
126
134
|
this._stopCatch();
|
|
127
135
|
|
|
128
136
|
const executeMessage = this[kExecuteMessage];
|
|
@@ -144,7 +152,7 @@ proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
|
|
|
144
152
|
}
|
|
145
153
|
};
|
|
146
154
|
|
|
147
|
-
|
|
155
|
+
ConditionalEventDefinition.prototype._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
|
|
148
156
|
const messageType = message.properties.type;
|
|
149
157
|
switch (messageType) {
|
|
150
158
|
case 'discard': {
|
|
@@ -159,12 +167,12 @@ proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
|
|
|
159
167
|
}
|
|
160
168
|
};
|
|
161
169
|
|
|
162
|
-
|
|
170
|
+
ConditionalEventDefinition.prototype._stopCatch = function stopCatch() {
|
|
163
171
|
const {executionId, index} = this[kExecuteMessage].content;
|
|
164
172
|
this.activity.attachedTo.broker.cancel(`_onend-${executionId}_${index}`);
|
|
165
173
|
this.broker.cancel(`_api-${executionId}_${index}`);
|
|
166
174
|
};
|
|
167
175
|
|
|
168
|
-
|
|
176
|
+
ConditionalEventDefinition.prototype._debug = function debug(msg) {
|
|
169
177
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
170
178
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {brokerSafeId} from '../shared';
|
|
2
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
1
|
+
import {brokerSafeId} from '../shared.js';
|
|
2
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
const kCompleted = Symbol.for('completed');
|
|
5
5
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -36,20 +36,18 @@ export default function ErrorEventDefinition(activity, eventDefinition) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(proto, 'executionId', {
|
|
39
|
+
Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
|
|
42
40
|
get() {
|
|
43
41
|
const message = this[kExecuteMessage];
|
|
44
42
|
return message && message.content.executionId;
|
|
45
43
|
},
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
ErrorEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
49
47
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
53
51
|
this[kExecuteMessage] = executeMessage;
|
|
54
52
|
this[kCompleted] = false;
|
|
55
53
|
|
|
@@ -81,6 +79,8 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
81
79
|
consumerTag: `_onerror-${executionId}`,
|
|
82
80
|
});
|
|
83
81
|
broker.publish('execution', 'execute.expect', cloneContent(executeContent, {
|
|
82
|
+
pattern: 'activity.error',
|
|
83
|
+
exchange: 'execution',
|
|
84
84
|
expectRoutingKey,
|
|
85
85
|
expect: {...info.message},
|
|
86
86
|
}));
|
|
@@ -97,7 +97,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
97
97
|
broker.publish('event', 'activity.wait', waitContent);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
101
101
|
const executeContent = executeMessage.content;
|
|
102
102
|
const {executionId, parent} = executeContent;
|
|
103
103
|
|
|
@@ -120,7 +120,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
120
120
|
}));
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
ErrorEventDefinition.prototype._onErrorMessage = function onErrorMessage(routingKey, message) {
|
|
124
124
|
const error = message.content.error;
|
|
125
125
|
if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
|
|
126
126
|
|
|
@@ -132,7 +132,7 @@ proto._onErrorMessage = function onErrorMessage(routingKey, message) {
|
|
|
132
132
|
return this._catchError(routingKey, message, error);
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
|
|
136
136
|
const error = message.content.message;
|
|
137
137
|
if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
|
|
138
138
|
|
|
@@ -141,7 +141,7 @@ proto._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
|
|
|
141
141
|
return this._catchError(routingKey, message, error);
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
ErrorEventDefinition.prototype._catchError = function catchError(routingKey, message, error) {
|
|
145
145
|
this[kCompleted] = true;
|
|
146
146
|
|
|
147
147
|
this._stop();
|
|
@@ -171,7 +171,7 @@ proto._catchError = function catchError(routingKey, message, error) {
|
|
|
171
171
|
}));
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
ErrorEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
175
175
|
const messageType = message.properties.type;
|
|
176
176
|
|
|
177
177
|
switch (messageType) {
|
|
@@ -187,7 +187,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
ErrorEventDefinition.prototype._stop = function stop() {
|
|
191
191
|
const broker = this.broker, executionId = this.executionId;
|
|
192
192
|
broker.cancel(`_onthrow-${executionId}`);
|
|
193
193
|
broker.cancel(`_onerror-${executionId}`);
|
|
@@ -195,7 +195,7 @@ proto._stop = function stop() {
|
|
|
195
195
|
this[kMessageQ].purge();
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
ErrorEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
199
199
|
const referenceElement = this[kReferenceElement];
|
|
200
200
|
if (!referenceElement) {
|
|
201
201
|
return {
|
|
@@ -214,6 +214,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
214
214
|
return result;
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
ErrorEventDefinition.prototype._debug = function debug(msg) {
|
|
218
218
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
219
219
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue';
|
|
2
|
-
import {brokerSafeId} from '../shared';
|
|
3
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
1
|
+
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
+
import {brokerSafeId} from '../shared.js';
|
|
3
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kCompleted = Symbol.for('completed');
|
|
6
6
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -36,20 +36,18 @@ export default function EscalationEventDefinition(activity, eventDefinition) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(proto, 'executionId', {
|
|
39
|
+
Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
|
|
42
40
|
get() {
|
|
43
41
|
const message = this[kExecuteMessage];
|
|
44
42
|
return message && message.content.executionId;
|
|
45
43
|
},
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
EscalationEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
49
47
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
EscalationEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
53
51
|
this[kExecuteMessage] = executeMessage;
|
|
54
52
|
this[kCompleted] = false;
|
|
55
53
|
|
|
@@ -82,7 +80,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
82
80
|
broker.publish('event', 'activity.wait', waitContent);
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
EscalationEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
86
84
|
const executeContent = executeMessage.content;
|
|
87
85
|
const {executionId, parent} = executeContent;
|
|
88
86
|
|
|
@@ -102,7 +100,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
102
100
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
|
|
103
101
|
};
|
|
104
102
|
|
|
105
|
-
|
|
103
|
+
EscalationEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
106
104
|
const info = this[kReference];
|
|
107
105
|
if (getPropertyValue(message, 'content.message.id') !== info.message.id) return;
|
|
108
106
|
|
|
@@ -127,7 +125,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
127
125
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output, state: 'catch'}));
|
|
128
126
|
};
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
EscalationEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
131
129
|
switch (message.properties.type) {
|
|
132
130
|
case 'escalate': {
|
|
133
131
|
return this._onCatchMessage(routingKey, message);
|
|
@@ -144,13 +142,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
144
142
|
}
|
|
145
143
|
};
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
EscalationEventDefinition.prototype._stop = function stop() {
|
|
148
146
|
const broker = this.broker, executionId = this.executionId;
|
|
149
147
|
broker.cancel(`_api-${executionId}`);
|
|
150
148
|
broker.cancel(`_onescalate-${executionId}`);
|
|
151
149
|
};
|
|
152
150
|
|
|
153
|
-
|
|
151
|
+
EscalationEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
154
152
|
const referenceElement = this[kReferenceElement];
|
|
155
153
|
if (!referenceElement) {
|
|
156
154
|
return {
|
|
@@ -168,6 +166,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
168
166
|
return result;
|
|
169
167
|
};
|
|
170
168
|
|
|
171
|
-
|
|
169
|
+
EscalationEventDefinition.prototype._debug = function debug(msg) {
|
|
172
170
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
173
171
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {cloneContent, unshiftParent, shiftParent, cloneParent} from '../messageHelper';
|
|
1
|
+
import {cloneContent, unshiftParent, shiftParent, cloneParent} from '../messageHelper.js';
|
|
2
2
|
|
|
3
3
|
const kCompleted = Symbol.for('completed');
|
|
4
4
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
@@ -15,23 +15,21 @@ export default function EventDefinitionExecution(activity, eventDefinitions, com
|
|
|
15
15
|
this[kExecuteMessage] = null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(proto, 'completed', {
|
|
18
|
+
Object.defineProperty(EventDefinitionExecution.prototype, 'completed', {
|
|
21
19
|
enumerable: true,
|
|
22
20
|
get() {
|
|
23
21
|
return this[kCompleted];
|
|
24
22
|
},
|
|
25
23
|
});
|
|
26
24
|
|
|
27
|
-
Object.defineProperty(
|
|
25
|
+
Object.defineProperty(EventDefinitionExecution.prototype, 'stopped', {
|
|
28
26
|
enumerable: true,
|
|
29
27
|
get() {
|
|
30
28
|
return this[kStopped];
|
|
31
29
|
},
|
|
32
30
|
});
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
EventDefinitionExecution.prototype.execute = function execute(executeMessage) {
|
|
35
33
|
const content = executeMessage.content;
|
|
36
34
|
|
|
37
35
|
if (content.isDefinitionScope) return this._executeDefinition(executeMessage);
|
|
@@ -82,7 +80,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
EventDefinitionExecution.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
86
84
|
const messageType = message.properties.type;
|
|
87
85
|
switch (messageType) {
|
|
88
86
|
case 'stop':
|
|
@@ -91,7 +89,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
91
89
|
}
|
|
92
90
|
};
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
EventDefinitionExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
95
93
|
switch (routingKey) {
|
|
96
94
|
case 'execute.completed': {
|
|
97
95
|
this._stop();
|
|
@@ -111,7 +109,7 @@ proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
|
111
109
|
}
|
|
112
110
|
};
|
|
113
111
|
|
|
114
|
-
|
|
112
|
+
EventDefinitionExecution.prototype._complete = function complete(message) {
|
|
115
113
|
const {executionId, type, index, parent} = message.content;
|
|
116
114
|
this[kCompleted] = true;
|
|
117
115
|
|
|
@@ -127,7 +125,7 @@ proto._complete = function complete(message) {
|
|
|
127
125
|
this.broker.publish('execution', this.completedRoutingKey, completeContent, {correlationId: message.properties.correlationId});
|
|
128
126
|
};
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
EventDefinitionExecution.prototype._executeDefinition = function executeDefinition(message) {
|
|
131
129
|
const {executionId, index} = message.content;
|
|
132
130
|
const ed = this.eventDefinitions[index];
|
|
133
131
|
if (!ed) return this.activity.logger.warn(`<${executionId} (${this.id})> found no event definition on index ${index}`);
|
|
@@ -135,12 +133,12 @@ proto._executeDefinition = function executeDefinition(message) {
|
|
|
135
133
|
ed.execute(message);
|
|
136
134
|
};
|
|
137
135
|
|
|
138
|
-
|
|
136
|
+
EventDefinitionExecution.prototype._stop = function stop() {
|
|
139
137
|
this[kStopped] = true;
|
|
140
138
|
this.broker.cancel('_eventdefinition-execution-execute-tag');
|
|
141
139
|
this.broker.cancel('_eventdefinition-execution-api-tag');
|
|
142
140
|
};
|
|
143
141
|
|
|
144
|
-
|
|
142
|
+
EventDefinitionExecution.prototype._debug = function debug(executionId, msg) {
|
|
145
143
|
this.activity.logger.debug(`<${executionId} (${this.id})> ${msg}`);
|
|
146
144
|
};
|