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
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = CompensateEventDefinition;
|
|
7
|
-
var _shared = require("../shared");
|
|
8
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _shared = require("../shared.js");
|
|
8
|
+
var _messageHelper = require("../messageHelper.js");
|
|
9
9
|
const kCompleted = Symbol.for('completed');
|
|
10
10
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
11
11
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -29,31 +29,39 @@ function CompensateEventDefinition(activity, eventDefinition, context) {
|
|
|
29
29
|
this.logger = environment.Logger(type.toLowerCase());
|
|
30
30
|
if (!isThrowing) {
|
|
31
31
|
this[kCompleted] = false;
|
|
32
|
-
this[kAssociations] = context.getOutboundAssociations(id)
|
|
32
|
+
this[kAssociations] = context.getOutboundAssociations(id);
|
|
33
33
|
const messageQueueName = `${reference.referenceType}-${(0, _shared.brokerSafeId)(id)}-q`;
|
|
34
34
|
this[kMessageQ] = broker.assertQueue(messageQueueName, {
|
|
35
35
|
autoDelete: false,
|
|
36
36
|
durable: true
|
|
37
37
|
});
|
|
38
|
+
this[kCompensateQ] = broker.assertQueue('compensate-q', {
|
|
39
|
+
autoDelete: false,
|
|
40
|
+
durable: true
|
|
41
|
+
});
|
|
38
42
|
broker.bindQueue(messageQueueName, 'api', `*.${reference.referenceType}.#`, {
|
|
39
43
|
durable: true,
|
|
40
44
|
priority: 400
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(proto, 'executionId', {
|
|
48
|
+
Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
|
|
46
49
|
get() {
|
|
47
50
|
const message = this[kExecuteMessage];
|
|
48
51
|
return message && message.content.executionId;
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
|
-
|
|
54
|
+
CompensateEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
52
55
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
53
56
|
};
|
|
54
|
-
|
|
57
|
+
CompensateEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
55
58
|
this[kExecuteMessage] = executeMessage;
|
|
56
59
|
this[kCompleted] = false;
|
|
60
|
+
if (executeMessage.fields.routingKey === 'execute.compensating') {
|
|
61
|
+
this._debug('resumed at compensating');
|
|
62
|
+
this[kCompleted] = true;
|
|
63
|
+
return this._compensate();
|
|
64
|
+
}
|
|
57
65
|
const executeContent = executeMessage.content;
|
|
58
66
|
const {
|
|
59
67
|
executionId,
|
|
@@ -61,44 +69,34 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
61
69
|
} = executeContent;
|
|
62
70
|
this._debug('expect compensate');
|
|
63
71
|
const broker = this.broker;
|
|
72
|
+
broker.cancel('_convey-messages');
|
|
64
73
|
broker.assertExchange('compensate', 'topic');
|
|
65
|
-
this[kCompensateQ] = broker.assertQueue('compensate-q', {
|
|
66
|
-
durable: true,
|
|
67
|
-
autoDelete: false
|
|
68
|
-
});
|
|
69
74
|
broker.subscribeTmp('compensate', 'execute.#', this._onCollect.bind(this), {
|
|
70
75
|
noAck: true,
|
|
71
76
|
consumerTag: '_oncollect-messages'
|
|
72
77
|
});
|
|
73
|
-
broker.publish('execution', 'execute.detach', (0, _messageHelper.cloneContent)(executeContent, {
|
|
74
|
-
sourceExchange: 'execution',
|
|
75
|
-
bindExchange: 'compensate'
|
|
76
|
-
}));
|
|
77
78
|
this[kMessageQ].consume(this._onCompensateApiMessage.bind(this), {
|
|
78
79
|
noAck: true,
|
|
79
80
|
consumerTag: `_oncompensate-${executionId}`
|
|
80
81
|
});
|
|
81
82
|
if (this[kCompleted]) return;
|
|
82
|
-
|
|
83
|
-
broker.subscribeTmp('api', `activity.#.${executionId}`, onApiMessage, {
|
|
83
|
+
broker.subscribeTmp('api', `activity.#.${parent.executionId}#`, this._onApiMessage.bind(this), {
|
|
84
84
|
noAck: true,
|
|
85
85
|
consumerTag: `_api-${executionId}`
|
|
86
86
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
bindExchange: 'compensate'
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
broker.publish('event', 'activity.detach', detachContent);
|
|
87
|
+
broker.publish('execution', 'execute.detach', (0, _messageHelper.cloneContent)(executeContent, {
|
|
88
|
+
sourceExchange: 'execution',
|
|
89
|
+
bindExchange: 'compensate',
|
|
90
|
+
expect: 'compensate'
|
|
91
|
+
}));
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
CompensateEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
95
94
|
const executeContent = executeMessage.content;
|
|
96
95
|
const {
|
|
97
|
-
executionId,
|
|
98
96
|
parent
|
|
99
97
|
} = executeContent;
|
|
100
98
|
const parentExecutionId = parent && parent.executionId;
|
|
101
|
-
this.logger.debug(`<${
|
|
99
|
+
this.logger.debug(`<${parentExecutionId} (${this.id})> throw compensate`);
|
|
102
100
|
const broker = this.broker;
|
|
103
101
|
const throwContent = (0, _messageHelper.cloneContent)(executeContent, {
|
|
104
102
|
executionId: parentExecutionId,
|
|
@@ -111,7 +109,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
111
109
|
});
|
|
112
110
|
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
113
111
|
};
|
|
114
|
-
|
|
112
|
+
CompensateEventDefinition.prototype._onCollect = function onCollect(routingKey, message) {
|
|
115
113
|
switch (routingKey) {
|
|
116
114
|
case 'execute.error':
|
|
117
115
|
case 'execute.completed':
|
|
@@ -120,13 +118,13 @@ proto._onCollect = function onCollect(routingKey, message) {
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
};
|
|
123
|
-
|
|
124
|
-
const output = message.content.message;
|
|
121
|
+
CompensateEventDefinition.prototype._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
|
|
125
122
|
this[kCompleted] = true;
|
|
126
|
-
|
|
127
|
-
this._debug('caught compensate event');
|
|
123
|
+
const output = message.content.message;
|
|
128
124
|
const broker = this.broker;
|
|
129
125
|
const executeContent = this[kExecuteMessage].content;
|
|
126
|
+
this._stopCollect();
|
|
127
|
+
this._debug('caught compensate event');
|
|
130
128
|
const catchContent = (0, _messageHelper.cloneContent)(executeContent, {
|
|
131
129
|
message: {
|
|
132
130
|
...output
|
|
@@ -134,28 +132,43 @@ proto._onCompensateApiMessage = function onCompensateApiMessage(routingKey, mess
|
|
|
134
132
|
executionId: executeContent.parent.executionId
|
|
135
133
|
});
|
|
136
134
|
catchContent.parent = (0, _messageHelper.shiftParent)(catchContent.parent);
|
|
135
|
+
this[kCompensateQ].queueMessage({
|
|
136
|
+
routingKey: 'execute.compensated'
|
|
137
|
+
}, (0, _messageHelper.cloneContent)(executeContent));
|
|
138
|
+
broker.publish('execution', 'execute.compensating', (0, _messageHelper.cloneContent)(executeContent, {
|
|
139
|
+
message: {
|
|
140
|
+
...output
|
|
141
|
+
}
|
|
142
|
+
}));
|
|
137
143
|
broker.publish('event', 'activity.catch', catchContent, {
|
|
138
144
|
type: 'catch'
|
|
139
145
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
return this._compensate();
|
|
147
|
+
};
|
|
148
|
+
CompensateEventDefinition.prototype._compensate = function compensate() {
|
|
149
|
+
return this[kCompensateQ].consume(this._onCollected.bind(this), {
|
|
143
150
|
noAck: true,
|
|
144
151
|
consumerTag: '_convey-messages'
|
|
145
152
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
};
|
|
154
|
+
CompensateEventDefinition.prototype._onCollected = function onCollected(routingKey, message) {
|
|
155
|
+
if (routingKey === 'execute.compensated') {
|
|
156
|
+
const broker = this.broker;
|
|
157
|
+
broker.cancel('_convey-messages');
|
|
158
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(message.content, {
|
|
159
|
+
cancelActivity: false
|
|
152
160
|
}));
|
|
153
161
|
}
|
|
154
|
-
};
|
|
155
|
-
proto._onCollected = function onCollected(routingKey, message) {
|
|
156
162
|
for (const association of this[kAssociations]) association.take((0, _messageHelper.cloneMessage)(message));
|
|
157
163
|
};
|
|
158
|
-
|
|
164
|
+
CompensateEventDefinition.prototype._onDiscardApiMessage = function onDiscardApiMessage(routingKey, message) {
|
|
165
|
+
this[kCompleted] = true;
|
|
166
|
+
this._stop();
|
|
167
|
+
this[kCompensateQ].purge();
|
|
168
|
+
for (const association of this[kAssociations]) association.discard((0, _messageHelper.cloneMessage)(message));
|
|
169
|
+
return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content));
|
|
170
|
+
};
|
|
171
|
+
CompensateEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
159
172
|
const messageType = message.properties.type;
|
|
160
173
|
switch (messageType) {
|
|
161
174
|
case 'compensate':
|
|
@@ -164,27 +177,26 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
164
177
|
}
|
|
165
178
|
case 'discard':
|
|
166
179
|
{
|
|
167
|
-
this
|
|
168
|
-
this._stop();
|
|
169
|
-
for (const association of this[kAssociations]) association.discard((0, _messageHelper.cloneMessage)(message));
|
|
170
|
-
return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content));
|
|
180
|
+
return this._onDiscardApiMessage(routingKey, message);
|
|
171
181
|
}
|
|
172
182
|
case 'stop':
|
|
173
183
|
{
|
|
174
|
-
this._stop();
|
|
175
|
-
break;
|
|
184
|
+
return this._stop();
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
187
|
};
|
|
179
|
-
|
|
188
|
+
CompensateEventDefinition.prototype._stopCollect = function stopCollect() {
|
|
180
189
|
const broker = this.broker,
|
|
181
190
|
executionId = this.executionId;
|
|
182
191
|
broker.cancel(`_api-${executionId}`);
|
|
183
192
|
broker.cancel(`_oncompensate-${executionId}`);
|
|
184
193
|
broker.cancel('_oncollect-messages');
|
|
185
|
-
broker.cancel('_convey-messages');
|
|
186
194
|
this[kMessageQ].purge();
|
|
187
195
|
};
|
|
188
|
-
|
|
196
|
+
CompensateEventDefinition.prototype._stop = function stop() {
|
|
197
|
+
this._stopCollect();
|
|
198
|
+
this.broker.cancel('_convey-messages');
|
|
199
|
+
};
|
|
200
|
+
CompensateEventDefinition.prototype._debug = function debug(msg) {
|
|
189
201
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
190
202
|
};
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = ConditionalEventDefinition;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
-
var _Errors = require("../error/Errors");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
|
+
var _Errors = require("../error/Errors.js");
|
|
9
9
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
10
10
|
function ConditionalEventDefinition(activity, eventDefinition) {
|
|
11
11
|
const {
|
|
@@ -27,18 +27,17 @@ function ConditionalEventDefinition(activity, eventDefinition) {
|
|
|
27
27
|
this.broker = broker;
|
|
28
28
|
this.logger = environment.Logger(type.toLowerCase());
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(proto, 'executionId', {
|
|
30
|
+
Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
|
|
32
31
|
get() {
|
|
33
32
|
const message = this[kExecuteMessage];
|
|
34
33
|
return message && message.content.executionId;
|
|
35
34
|
}
|
|
36
35
|
});
|
|
37
|
-
|
|
36
|
+
ConditionalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
38
37
|
this[kExecuteMessage] = executeMessage;
|
|
39
38
|
return this.isWaiting ? this.executeWait(executeMessage) : this.executeCatch(executeMessage);
|
|
40
39
|
};
|
|
41
|
-
|
|
40
|
+
ConditionalEventDefinition.prototype.executeWait = function executeWait(executeMessage) {
|
|
42
41
|
const executeContent = executeMessage.content;
|
|
43
42
|
const {
|
|
44
43
|
executionId,
|
|
@@ -63,13 +62,16 @@ proto.executeWait = function executeWait(executeMessage) {
|
|
|
63
62
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
64
63
|
broker.publish('event', 'activity.wait', waitContent);
|
|
65
64
|
};
|
|
66
|
-
|
|
65
|
+
ConditionalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
67
66
|
const executeContent = executeMessage.content;
|
|
68
67
|
const {
|
|
69
68
|
executionId,
|
|
70
|
-
index
|
|
69
|
+
index,
|
|
70
|
+
parent
|
|
71
71
|
} = executeContent;
|
|
72
|
-
|
|
72
|
+
const parentExecutionId = parent.executionId;
|
|
73
|
+
const broker = this.broker;
|
|
74
|
+
broker.subscribeTmp('api', `activity.#.${executionId}`, this._onCatchApiMessage.bind(this), {
|
|
73
75
|
noAck: true,
|
|
74
76
|
consumerTag: `_api-${executionId}_${index}`
|
|
75
77
|
});
|
|
@@ -82,8 +84,14 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
82
84
|
priority: 300,
|
|
83
85
|
consumerTag: `_onend-${executionId}_${index}`
|
|
84
86
|
});
|
|
87
|
+
const waitContent = (0, _messageHelper.cloneContent)(executeContent, {
|
|
88
|
+
executionId: parentExecutionId,
|
|
89
|
+
condition: this.condition
|
|
90
|
+
});
|
|
91
|
+
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
92
|
+
broker.publish('event', 'activity.wait', waitContent);
|
|
85
93
|
};
|
|
86
|
-
|
|
94
|
+
ConditionalEventDefinition.prototype._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
|
|
87
95
|
const messageType = message.properties.type;
|
|
88
96
|
switch (messageType) {
|
|
89
97
|
case 'signal':
|
|
@@ -103,7 +111,7 @@ proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
|
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
};
|
|
106
|
-
|
|
114
|
+
ConditionalEventDefinition.prototype._evaluateWait = function evaluate(message) {
|
|
107
115
|
const executeMessage = this[kExecuteMessage];
|
|
108
116
|
const broker = this.broker,
|
|
109
117
|
executeContent = executeMessage.content;
|
|
@@ -126,13 +134,13 @@ proto._evaluateWait = function evaluate(message) {
|
|
|
126
134
|
output
|
|
127
135
|
}));
|
|
128
136
|
};
|
|
129
|
-
|
|
137
|
+
ConditionalEventDefinition.prototype._stopWait = function stopWait() {
|
|
130
138
|
const broker = this.broker,
|
|
131
139
|
executionId = this.executionId;
|
|
132
140
|
broker.cancel(`_api-${executionId}`);
|
|
133
141
|
broker.cancel(`_parent-signal-${executionId}`);
|
|
134
142
|
};
|
|
135
|
-
|
|
143
|
+
ConditionalEventDefinition.prototype._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
|
|
136
144
|
this._stopCatch();
|
|
137
145
|
const executeMessage = this[kExecuteMessage];
|
|
138
146
|
const broker = this.broker,
|
|
@@ -156,7 +164,7 @@ proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
|
|
|
156
164
|
}));
|
|
157
165
|
}
|
|
158
166
|
};
|
|
159
|
-
|
|
167
|
+
ConditionalEventDefinition.prototype._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
|
|
160
168
|
const messageType = message.properties.type;
|
|
161
169
|
switch (messageType) {
|
|
162
170
|
case 'discard':
|
|
@@ -174,7 +182,7 @@ proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
|
|
|
174
182
|
}
|
|
175
183
|
}
|
|
176
184
|
};
|
|
177
|
-
|
|
185
|
+
ConditionalEventDefinition.prototype._stopCatch = function stopCatch() {
|
|
178
186
|
const {
|
|
179
187
|
executionId,
|
|
180
188
|
index
|
|
@@ -182,6 +190,6 @@ proto._stopCatch = function stopCatch() {
|
|
|
182
190
|
this.activity.attachedTo.broker.cancel(`_onend-${executionId}_${index}`);
|
|
183
191
|
this.broker.cancel(`_api-${executionId}_${index}`);
|
|
184
192
|
};
|
|
185
|
-
|
|
193
|
+
ConditionalEventDefinition.prototype._debug = function debug(msg) {
|
|
186
194
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
187
195
|
};
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = ErrorEventDefinition;
|
|
7
|
-
var _shared = require("../shared");
|
|
8
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _shared = require("../shared.js");
|
|
8
|
+
var _messageHelper = require("../messageHelper.js");
|
|
9
9
|
const kCompleted = Symbol.for('completed');
|
|
10
10
|
const kMessageQ = Symbol.for('messageQ');
|
|
11
11
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
@@ -49,17 +49,16 @@ function ErrorEventDefinition(activity, eventDefinition) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(proto, 'executionId', {
|
|
52
|
+
Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
|
|
54
53
|
get() {
|
|
55
54
|
const message = this[kExecuteMessage];
|
|
56
55
|
return message && message.content.executionId;
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
|
-
|
|
58
|
+
ErrorEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
60
59
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
63
62
|
this[kExecuteMessage] = executeMessage;
|
|
64
63
|
this[kCompleted] = false;
|
|
65
64
|
const executeContent = executeMessage.content;
|
|
@@ -87,6 +86,8 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
87
86
|
consumerTag: `_onerror-${executionId}`
|
|
88
87
|
});
|
|
89
88
|
broker.publish('execution', 'execute.expect', (0, _messageHelper.cloneContent)(executeContent, {
|
|
89
|
+
pattern: 'activity.error',
|
|
90
|
+
exchange: 'execution',
|
|
90
91
|
expectRoutingKey,
|
|
91
92
|
expect: {
|
|
92
93
|
...info.message
|
|
@@ -103,7 +104,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
103
104
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
104
105
|
broker.publish('event', 'activity.wait', waitContent);
|
|
105
106
|
};
|
|
106
|
-
|
|
107
|
+
ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
107
108
|
const executeContent = executeMessage.content;
|
|
108
109
|
const {
|
|
109
110
|
executionId,
|
|
@@ -130,7 +131,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
130
131
|
}
|
|
131
132
|
}));
|
|
132
133
|
};
|
|
133
|
-
|
|
134
|
+
ErrorEventDefinition.prototype._onErrorMessage = function onErrorMessage(routingKey, message) {
|
|
134
135
|
const error = message.content.error;
|
|
135
136
|
if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
|
|
136
137
|
if (!error) return;
|
|
@@ -138,14 +139,14 @@ proto._onErrorMessage = function onErrorMessage(routingKey, message) {
|
|
|
138
139
|
if ('' + error.code !== '' + info.message.code) return;
|
|
139
140
|
return this._catchError(routingKey, message, error);
|
|
140
141
|
};
|
|
141
|
-
|
|
142
|
+
ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
|
|
142
143
|
const error = message.content.message;
|
|
143
144
|
if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
|
|
144
145
|
const info = this[kReferenceInfo];
|
|
145
146
|
if (info.message.id !== (error && error.id)) return;
|
|
146
147
|
return this._catchError(routingKey, message, error);
|
|
147
148
|
};
|
|
148
|
-
|
|
149
|
+
ErrorEventDefinition.prototype._catchError = function catchError(routingKey, message, error) {
|
|
149
150
|
this[kCompleted] = true;
|
|
150
151
|
this._stop();
|
|
151
152
|
this._debug(`caught ${this[kReferenceInfo].description}`);
|
|
@@ -171,7 +172,7 @@ proto._catchError = function catchError(routingKey, message, error) {
|
|
|
171
172
|
state: 'catch'
|
|
172
173
|
}));
|
|
173
174
|
};
|
|
174
|
-
|
|
175
|
+
ErrorEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
175
176
|
const messageType = message.properties.type;
|
|
176
177
|
switch (messageType) {
|
|
177
178
|
case 'discard':
|
|
@@ -187,7 +188,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
+
ErrorEventDefinition.prototype._stop = function stop() {
|
|
191
192
|
const broker = this.broker,
|
|
192
193
|
executionId = this.executionId;
|
|
193
194
|
broker.cancel(`_onthrow-${executionId}`);
|
|
@@ -195,7 +196,7 @@ proto._stop = function stop() {
|
|
|
195
196
|
broker.cancel(`_api-${executionId}`);
|
|
196
197
|
this[kMessageQ].purge();
|
|
197
198
|
};
|
|
198
|
-
|
|
199
|
+
ErrorEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
199
200
|
const referenceElement = this[kReferenceElement];
|
|
200
201
|
if (!referenceElement) {
|
|
201
202
|
return {
|
|
@@ -212,6 +213,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
212
213
|
if (result.message.code) result.description += ` code ${result.message.code}`;
|
|
213
214
|
return result;
|
|
214
215
|
};
|
|
215
|
-
|
|
216
|
+
ErrorEventDefinition.prototype._debug = function debug(msg) {
|
|
216
217
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
217
218
|
};
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = EscalationEventDefinition;
|
|
7
|
-
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
|
|
8
|
-
var _shared = require("../shared");
|
|
9
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
|
|
8
|
+
var _shared = require("../shared.js");
|
|
9
|
+
var _messageHelper = require("../messageHelper.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const kCompleted = Symbol.for('completed');
|
|
12
12
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -50,17 +50,16 @@ function EscalationEventDefinition(activity, eventDefinition) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
Object.defineProperty(proto, 'executionId', {
|
|
53
|
+
Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
|
|
55
54
|
get() {
|
|
56
55
|
const message = this[kExecuteMessage];
|
|
57
56
|
return message && message.content.executionId;
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
|
-
|
|
59
|
+
EscalationEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
61
60
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
EscalationEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
64
63
|
this[kExecuteMessage] = executeMessage;
|
|
65
64
|
this[kCompleted] = false;
|
|
66
65
|
const executeContent = executeMessage.content;
|
|
@@ -90,7 +89,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
90
89
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
91
90
|
broker.publish('event', 'activity.wait', waitContent);
|
|
92
91
|
};
|
|
93
|
-
|
|
92
|
+
EscalationEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
94
93
|
const executeContent = executeMessage.content;
|
|
95
94
|
const {
|
|
96
95
|
executionId,
|
|
@@ -111,7 +110,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
111
110
|
});
|
|
112
111
|
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
113
112
|
};
|
|
114
|
-
|
|
113
|
+
EscalationEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
115
114
|
const info = this[kReference];
|
|
116
115
|
if ((0, _getPropertyValue.default)(message, 'content.message.id') !== info.message.id) return;
|
|
117
116
|
const output = message.content.message;
|
|
@@ -139,7 +138,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
139
138
|
state: 'catch'
|
|
140
139
|
}));
|
|
141
140
|
};
|
|
142
|
-
|
|
141
|
+
EscalationEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
143
142
|
switch (message.properties.type) {
|
|
144
143
|
case 'escalate':
|
|
145
144
|
{
|
|
@@ -158,13 +157,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
};
|
|
161
|
-
|
|
160
|
+
EscalationEventDefinition.prototype._stop = function stop() {
|
|
162
161
|
const broker = this.broker,
|
|
163
162
|
executionId = this.executionId;
|
|
164
163
|
broker.cancel(`_api-${executionId}`);
|
|
165
164
|
broker.cancel(`_onescalate-${executionId}`);
|
|
166
165
|
};
|
|
167
|
-
|
|
166
|
+
EscalationEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
168
167
|
const referenceElement = this[kReferenceElement];
|
|
169
168
|
if (!referenceElement) {
|
|
170
169
|
return {
|
|
@@ -180,6 +179,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
180
179
|
result.description = `${result.message.name} <${result.message.id}>`;
|
|
181
180
|
return result;
|
|
182
181
|
};
|
|
183
|
-
|
|
182
|
+
EscalationEventDefinition.prototype._debug = function debug(msg) {
|
|
184
183
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
185
184
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = EventDefinitionExecution;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
8
|
const kCompleted = Symbol.for('completed');
|
|
9
9
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
10
10
|
const kStopped = Symbol.for('stopped');
|
|
@@ -18,20 +18,19 @@ function EventDefinitionExecution(activity, eventDefinitions, completedRoutingKe
|
|
|
18
18
|
this[kStopped] = false;
|
|
19
19
|
this[kExecuteMessage] = null;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(proto, 'completed', {
|
|
21
|
+
Object.defineProperty(EventDefinitionExecution.prototype, 'completed', {
|
|
23
22
|
enumerable: true,
|
|
24
23
|
get() {
|
|
25
24
|
return this[kCompleted];
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
|
-
Object.defineProperty(
|
|
27
|
+
Object.defineProperty(EventDefinitionExecution.prototype, 'stopped', {
|
|
29
28
|
enumerable: true,
|
|
30
29
|
get() {
|
|
31
30
|
return this[kStopped];
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
|
-
|
|
33
|
+
EventDefinitionExecution.prototype.execute = function execute(executeMessage) {
|
|
35
34
|
const content = executeMessage.content;
|
|
36
35
|
if (content.isDefinitionScope) return this._executeDefinition(executeMessage);
|
|
37
36
|
if (!content.isRootScope) return;
|
|
@@ -71,7 +70,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
71
70
|
broker.publish('execution', 'execute.start', edContent);
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
|
-
|
|
73
|
+
EventDefinitionExecution.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
75
74
|
const messageType = message.properties.type;
|
|
76
75
|
switch (messageType) {
|
|
77
76
|
case 'stop':
|
|
@@ -79,7 +78,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
79
78
|
return this._stop();
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
|
-
|
|
81
|
+
EventDefinitionExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
83
82
|
switch (routingKey) {
|
|
84
83
|
case 'execute.completed':
|
|
85
84
|
{
|
|
@@ -103,7 +102,7 @@ proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
|
-
|
|
105
|
+
EventDefinitionExecution.prototype._complete = function complete(message) {
|
|
107
106
|
const {
|
|
108
107
|
executionId,
|
|
109
108
|
type,
|
|
@@ -122,7 +121,7 @@ proto._complete = function complete(message) {
|
|
|
122
121
|
correlationId: message.properties.correlationId
|
|
123
122
|
});
|
|
124
123
|
};
|
|
125
|
-
|
|
124
|
+
EventDefinitionExecution.prototype._executeDefinition = function executeDefinition(message) {
|
|
126
125
|
const {
|
|
127
126
|
executionId,
|
|
128
127
|
index
|
|
@@ -132,11 +131,11 @@ proto._executeDefinition = function executeDefinition(message) {
|
|
|
132
131
|
this._debug(executionId, `execute event definition ${ed.type}, index ${index}`);
|
|
133
132
|
ed.execute(message);
|
|
134
133
|
};
|
|
135
|
-
|
|
134
|
+
EventDefinitionExecution.prototype._stop = function stop() {
|
|
136
135
|
this[kStopped] = true;
|
|
137
136
|
this.broker.cancel('_eventdefinition-execution-execute-tag');
|
|
138
137
|
this.broker.cancel('_eventdefinition-execution-api-tag');
|
|
139
138
|
};
|
|
140
|
-
|
|
139
|
+
EventDefinitionExecution.prototype._debug = function debug(executionId, msg) {
|
|
141
140
|
this.activity.logger.debug(`<${executionId} (${this.id})> ${msg}`);
|
|
142
141
|
};
|