bpmn-elements 8.2.0 → 8.2.2
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 +8 -0
- package/dist/index.js +0 -49
- package/dist/src/Api.js +4 -19
- package/dist/src/Context.js +0 -35
- package/dist/src/Environment.js +18 -44
- package/dist/src/EventBroker.js +8 -27
- package/dist/src/Expressions.js +0 -13
- package/dist/src/ExtensionsMapper.js +0 -12
- package/dist/src/MessageFormatter.js +0 -33
- package/dist/src/Scripts.js +2 -9
- package/dist/src/Timers.js +0 -9
- package/dist/src/activity/Activity.js +39 -243
- package/dist/src/activity/ActivityExecution.js +8 -76
- package/dist/src/activity/Dummy.js +2 -3
- package/dist/src/activity/Escalation.js +4 -4
- package/dist/src/activity/ExecutionScope.js +0 -4
- package/dist/src/activity/Message.js +4 -4
- package/dist/src/activity/Signal.js +4 -4
- package/dist/src/definition/Definition.js +12 -133
- package/dist/src/definition/DefinitionExecution.js +10 -160
- package/dist/src/error/BpmnError.js +2 -3
- package/dist/src/error/Errors.js +0 -16
- package/dist/src/eventDefinitions/CancelEventDefinition.js +2 -35
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +3 -34
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +3 -42
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +11 -41
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +7 -37
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +0 -30
- package/dist/src/eventDefinitions/LinkEventDefinition.js +11 -37
- package/dist/src/eventDefinitions/MessageEventDefinition.js +11 -44
- package/dist/src/eventDefinitions/SignalEventDefinition.js +9 -46
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +0 -3
- package/dist/src/eventDefinitions/TimerEventDefinition.js +8 -52
- package/dist/src/events/BoundaryEvent.js +4 -44
- package/dist/src/events/EndEvent.js +2 -11
- package/dist/src/events/IntermediateCatchEvent.js +0 -13
- package/dist/src/events/IntermediateThrowEvent.js +2 -11
- package/dist/src/events/StartEvent.js +5 -25
- package/dist/src/flows/Association.js +4 -27
- package/dist/src/flows/MessageFlow.js +6 -18
- package/dist/src/flows/SequenceFlow.js +4 -39
- package/dist/src/gateways/EventBasedGateway.js +0 -21
- package/dist/src/gateways/ExclusiveGateway.js +0 -6
- package/dist/src/gateways/InclusiveGateway.js +0 -6
- package/dist/src/gateways/ParallelGateway.js +2 -7
- package/dist/src/getPropertyValue.js +0 -30
- package/dist/src/io/BpmnIO.js +2 -7
- package/dist/src/io/EnvironmentDataObject.js +0 -8
- package/dist/src/io/EnvironmentDataStore.js +0 -8
- package/dist/src/io/EnvironmentDataStoreReference.js +0 -8
- package/dist/src/io/InputOutputSpecification.js +12 -37
- package/dist/src/io/Properties.js +6 -39
- package/dist/src/messageHelper.js +10 -23
- package/dist/src/process/Process.js +10 -112
- package/dist/src/process/ProcessExecution.js +24 -170
- package/dist/src/shared.js +0 -7
- package/dist/src/tasks/CallActivity.js +2 -23
- package/dist/src/tasks/LoopCharacteristics.js +16 -67
- package/dist/src/tasks/ReceiveTask.js +8 -48
- package/dist/src/tasks/ScriptTask.js +1 -15
- package/dist/src/tasks/ServiceImplementation.js +0 -4
- package/dist/src/tasks/ServiceTask.js +0 -20
- package/dist/src/tasks/SignalTask.js +2 -21
- package/dist/src/tasks/StandardLoopCharacteristics.js +4 -5
- package/dist/src/tasks/SubProcess.js +4 -52
- package/dist/src/tasks/Task.js +0 -8
- package/dist/src/tasks/Transaction.js +0 -3
- package/package.json +7 -7
- package/src/Context.js +0 -1
- package/src/activity/Activity.js +1 -1
- package/src/gateways/EventBasedGateway.js +0 -1
- package/src/io/InputOutputSpecification.js +0 -1
- package/src/process/ProcessExecution.js +8 -1
- package/src/tasks/StandardLoopCharacteristics.js +0 -1
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = TimerEventDefinition;
|
|
7
|
-
|
|
8
7
|
var _messageHelper = require("../messageHelper");
|
|
9
|
-
|
|
10
8
|
var _iso8601Duration = require("iso8601-duration");
|
|
11
|
-
|
|
12
9
|
const kStopped = Symbol.for('stopped');
|
|
13
10
|
const kTimerContent = Symbol.for('timerContent');
|
|
14
11
|
const kTimer = Symbol.for('timer');
|
|
15
12
|
const repeatPattern = /^\s*R(\d+)\//;
|
|
16
|
-
|
|
17
13
|
function TimerEventDefinition(activity, eventDefinition) {
|
|
18
14
|
const type = this.type = eventDefinition.type || 'TimerEventDefinition';
|
|
19
15
|
this.activity = activity;
|
|
@@ -32,52 +28,42 @@ function TimerEventDefinition(activity, eventDefinition) {
|
|
|
32
28
|
this[kStopped] = false;
|
|
33
29
|
this[kTimer] = null;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
const proto = TimerEventDefinition.prototype;
|
|
37
32
|
Object.defineProperty(proto, 'executionId', {
|
|
38
33
|
get() {
|
|
39
34
|
const content = this[kTimerContent];
|
|
40
35
|
return content && content.executionId;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
});
|
|
44
38
|
Object.defineProperty(proto, 'stopped', {
|
|
45
39
|
enumerable: true,
|
|
46
|
-
|
|
47
40
|
get() {
|
|
48
41
|
return this[kStopped];
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
});
|
|
52
44
|
Object.defineProperty(proto, 'timer', {
|
|
53
45
|
enumerable: true,
|
|
54
|
-
|
|
55
46
|
get() {
|
|
56
47
|
return this[kTimer];
|
|
57
48
|
}
|
|
58
|
-
|
|
59
49
|
});
|
|
60
|
-
|
|
61
50
|
proto.execute = function execute(executeMessage) {
|
|
62
51
|
const {
|
|
63
52
|
routingKey: executeKey,
|
|
64
53
|
redelivered: isResumed
|
|
65
54
|
} = executeMessage.fields;
|
|
66
55
|
const timer = this[kTimer];
|
|
67
|
-
|
|
68
56
|
if (timer && executeKey === 'execute.timer') {
|
|
69
57
|
return;
|
|
70
58
|
}
|
|
71
|
-
|
|
72
59
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
73
60
|
this[kStopped] = false;
|
|
74
61
|
const content = executeMessage.content;
|
|
75
62
|
const executionId = content.executionId;
|
|
76
63
|
const startedAt = this.startedAt = 'startedAt' in content ? new Date(content.startedAt) : new Date();
|
|
77
|
-
|
|
78
64
|
const resolvedTimer = this._getTimers(executeMessage);
|
|
79
|
-
|
|
80
|
-
|
|
65
|
+
const timerContent = this[kTimerContent] = (0, _messageHelper.cloneContent)(content, {
|
|
66
|
+
...resolvedTimer,
|
|
81
67
|
...(isResumed && {
|
|
82
68
|
isResumed
|
|
83
69
|
}),
|
|
@@ -107,20 +93,15 @@ proto.execute = function execute(executeMessage) {
|
|
|
107
93
|
state: 'timeout'
|
|
108
94
|
});
|
|
109
95
|
};
|
|
110
|
-
|
|
111
96
|
proto.stop = function stopTimer() {
|
|
112
97
|
const timer = this[kTimer];
|
|
113
98
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
114
99
|
};
|
|
115
|
-
|
|
116
100
|
proto._completed = function completed(completeContent, options) {
|
|
117
101
|
this._stop();
|
|
118
|
-
|
|
119
102
|
const stoppedAt = new Date();
|
|
120
103
|
const runningTime = stoppedAt.getTime() - this.startedAt.getTime();
|
|
121
|
-
|
|
122
104
|
this._debug(`completed in ${runningTime}ms`);
|
|
123
|
-
|
|
124
105
|
const timerContent = this[kTimerContent];
|
|
125
106
|
const content = {
|
|
126
107
|
stoppedAt,
|
|
@@ -130,17 +111,15 @@ proto._completed = function completed(completeContent, options) {
|
|
|
130
111
|
};
|
|
131
112
|
const broker = this.broker;
|
|
132
113
|
broker.publish('event', 'activity.timeout', (0, _messageHelper.cloneContent)(timerContent, content), options);
|
|
133
|
-
|
|
134
114
|
if (timerContent.repeat > 1) {
|
|
135
115
|
const repeat = timerContent.repeat - 1;
|
|
136
|
-
broker.publish('execution', 'execute.repeat', (0, _messageHelper.cloneContent)(timerContent, {
|
|
116
|
+
broker.publish('execution', 'execute.repeat', (0, _messageHelper.cloneContent)(timerContent, {
|
|
117
|
+
...content,
|
|
137
118
|
repeat
|
|
138
119
|
}), options);
|
|
139
120
|
}
|
|
140
|
-
|
|
141
121
|
broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(timerContent, content), options);
|
|
142
122
|
};
|
|
143
|
-
|
|
144
123
|
proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, message) {
|
|
145
124
|
if (!message.properties.delegate) return;
|
|
146
125
|
const content = message.content;
|
|
@@ -158,7 +137,8 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
158
137
|
correlationId
|
|
159
138
|
} = message.properties;
|
|
160
139
|
this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kTimerContent], {
|
|
161
|
-
message: {
|
|
140
|
+
message: {
|
|
141
|
+
...content.message
|
|
162
142
|
}
|
|
163
143
|
}), {
|
|
164
144
|
correlationId,
|
|
@@ -166,18 +146,15 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
166
146
|
});
|
|
167
147
|
return this._onApiMessage(routingKey, message);
|
|
168
148
|
};
|
|
169
|
-
|
|
170
149
|
proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
171
150
|
const {
|
|
172
151
|
type: messageType,
|
|
173
152
|
correlationId
|
|
174
153
|
} = message.properties;
|
|
175
|
-
|
|
176
154
|
switch (messageType) {
|
|
177
155
|
case 'cancel':
|
|
178
156
|
{
|
|
179
157
|
this._stop();
|
|
180
|
-
|
|
181
158
|
return this._completed({
|
|
182
159
|
state: 'cancel',
|
|
183
160
|
...(message.content.message && {
|
|
@@ -187,20 +164,15 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
187
164
|
correlationId
|
|
188
165
|
});
|
|
189
166
|
}
|
|
190
|
-
|
|
191
167
|
case 'stop':
|
|
192
168
|
{
|
|
193
169
|
this._stop();
|
|
194
|
-
|
|
195
170
|
return this._debug('stopped');
|
|
196
171
|
}
|
|
197
|
-
|
|
198
172
|
case 'discard':
|
|
199
173
|
{
|
|
200
174
|
this._stop();
|
|
201
|
-
|
|
202
175
|
this._debug('discarded');
|
|
203
|
-
|
|
204
176
|
return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kTimerContent], {
|
|
205
177
|
state: 'discard'
|
|
206
178
|
}), {
|
|
@@ -209,7 +181,6 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
209
181
|
}
|
|
210
182
|
}
|
|
211
183
|
};
|
|
212
|
-
|
|
213
184
|
proto._stop = function stop() {
|
|
214
185
|
this[kStopped] = true;
|
|
215
186
|
const timer = this[kTimer];
|
|
@@ -218,20 +189,18 @@ proto._stop = function stop() {
|
|
|
218
189
|
broker.cancel(`_api-${this.executionId}`);
|
|
219
190
|
broker.cancel(`_api-delegated-${this.executionId}`);
|
|
220
191
|
};
|
|
221
|
-
|
|
222
192
|
proto._getTimers = function getTimers(executeMessage) {
|
|
223
193
|
const content = executeMessage.content;
|
|
224
194
|
const now = Date.now();
|
|
225
|
-
const result = {
|
|
195
|
+
const result = {
|
|
196
|
+
...('expireAt' in content && {
|
|
226
197
|
expireAt: new Date(content.expireAt)
|
|
227
198
|
})
|
|
228
199
|
};
|
|
229
|
-
|
|
230
200
|
for (const t of ['timeDuration', 'timeDate', 'timeCycle']) {
|
|
231
201
|
if (t in content) result[t] = content[t];else if (t in this) result[t] = this.environment.resolveExpression(this[t], executeMessage);else continue;
|
|
232
202
|
let expireAtDate, repeat;
|
|
233
203
|
const timerStr = result[t];
|
|
234
|
-
|
|
235
204
|
if (timerStr) {
|
|
236
205
|
switch (t) {
|
|
237
206
|
case 'timeCycle':
|
|
@@ -239,42 +208,34 @@ proto._getTimers = function getTimers(executeMessage) {
|
|
|
239
208
|
const mRepeat = timerStr.match(repeatPattern);
|
|
240
209
|
if (mRepeat && mRepeat.length) repeat = parseInt(mRepeat[1]);
|
|
241
210
|
}
|
|
242
|
-
|
|
243
211
|
case 'timeDuration':
|
|
244
212
|
{
|
|
245
213
|
const delay = this._getDurationInMilliseconds(timerStr);
|
|
246
|
-
|
|
247
214
|
if (delay !== undefined) expireAtDate = new Date(now + delay);
|
|
248
215
|
break;
|
|
249
216
|
}
|
|
250
|
-
|
|
251
217
|
case 'timeDate':
|
|
252
218
|
{
|
|
253
219
|
const dateStr = result[t];
|
|
254
220
|
const ms = Date.parse(dateStr);
|
|
255
|
-
|
|
256
221
|
if (!isNaN(ms)) {
|
|
257
222
|
expireAtDate = new Date(ms);
|
|
258
223
|
} else {
|
|
259
224
|
this._warn(`invalid timeDate >${dateStr}<`);
|
|
260
225
|
}
|
|
261
|
-
|
|
262
226
|
break;
|
|
263
227
|
}
|
|
264
228
|
}
|
|
265
229
|
} else {
|
|
266
230
|
expireAtDate = new Date(now);
|
|
267
231
|
}
|
|
268
|
-
|
|
269
232
|
if (!expireAtDate) continue;
|
|
270
|
-
|
|
271
233
|
if (!('expireAt' in result) || result.expireAt > expireAtDate) {
|
|
272
234
|
result.timerType = t;
|
|
273
235
|
result.expireAt = expireAtDate;
|
|
274
236
|
if (repeat) result.repeat = repeat;
|
|
275
237
|
}
|
|
276
238
|
}
|
|
277
|
-
|
|
278
239
|
if ('expireAt' in result) {
|
|
279
240
|
result.timeout = result.expireAt - now;
|
|
280
241
|
} else if ('timeout' in content) {
|
|
@@ -282,14 +243,11 @@ proto._getTimers = function getTimers(executeMessage) {
|
|
|
282
243
|
} else if (!Object.keys(result).length) {
|
|
283
244
|
result.timeout = 0;
|
|
284
245
|
}
|
|
285
|
-
|
|
286
246
|
if (content.inbound && 'repeat' in content.inbound[0]) {
|
|
287
247
|
result.repeat = content.inbound[0].repeat;
|
|
288
248
|
}
|
|
289
|
-
|
|
290
249
|
return result;
|
|
291
250
|
};
|
|
292
|
-
|
|
293
251
|
proto._getDurationInMilliseconds = function getDurationInMilliseconds(duration) {
|
|
294
252
|
try {
|
|
295
253
|
return (0, _iso8601Duration.toSeconds)((0, _iso8601Duration.parse)(duration)) * 1000;
|
|
@@ -297,11 +255,9 @@ proto._getDurationInMilliseconds = function getDurationInMilliseconds(duration)
|
|
|
297
255
|
this._warn(`failed to parse ${this.timerType} >${duration}<: ${err.message}`);
|
|
298
256
|
}
|
|
299
257
|
};
|
|
300
|
-
|
|
301
258
|
proto._debug = function debug(msg) {
|
|
302
259
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
303
260
|
};
|
|
304
|
-
|
|
305
261
|
proto._warn = function debug(msg) {
|
|
306
262
|
this.logger.warn(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
307
263
|
};
|
|
@@ -5,27 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BoundaryEventBehaviour = BoundaryEventBehaviour;
|
|
7
7
|
exports.default = BoundaryEvent;
|
|
8
|
-
|
|
9
8
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
|
-
|
|
11
9
|
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
12
|
-
|
|
13
10
|
var _messageHelper = require("../messageHelper");
|
|
14
|
-
|
|
15
11
|
var _shared = require("../shared");
|
|
16
|
-
|
|
17
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
13
|
const kAttachedTags = Symbol.for('attachedConsumers');
|
|
20
14
|
const kCompleteContent = Symbol.for('completeContent');
|
|
21
15
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
22
16
|
const kExecution = Symbol.for('execution');
|
|
23
17
|
const kShovels = Symbol.for('shovels');
|
|
24
|
-
|
|
25
18
|
function BoundaryEvent(activityDef, context) {
|
|
26
19
|
return new _Activity.default(BoundaryEventBehaviour, activityDef, context);
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
function BoundaryEventBehaviour(activity) {
|
|
30
22
|
this.id = activity.id;
|
|
31
23
|
this.type = activity.type;
|
|
@@ -37,32 +29,26 @@ function BoundaryEventBehaviour(activity) {
|
|
|
37
29
|
this[kShovels] = [];
|
|
38
30
|
this[kAttachedTags] = [];
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
const proto = BoundaryEventBehaviour.prototype;
|
|
42
33
|
Object.defineProperty(proto, 'executionId', {
|
|
43
34
|
get() {
|
|
44
35
|
const message = this[kExecuteMessage];
|
|
45
36
|
return message && message.content.executionId;
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
});
|
|
49
39
|
Object.defineProperty(proto, 'cancelActivity', {
|
|
50
40
|
enumerable: true,
|
|
51
|
-
|
|
52
41
|
get() {
|
|
53
42
|
const behaviour = this.activity.behaviour || {};
|
|
54
43
|
return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
});
|
|
58
|
-
|
|
59
46
|
proto.execute = function execute(executeMessage) {
|
|
60
47
|
const {
|
|
61
48
|
isRootScope,
|
|
62
49
|
executionId
|
|
63
50
|
} = executeMessage.content;
|
|
64
51
|
const eventDefinitionExecution = this[kExecution];
|
|
65
|
-
|
|
66
52
|
if (isRootScope) {
|
|
67
53
|
this[kExecuteMessage] = executeMessage;
|
|
68
54
|
const broker = this.broker;
|
|
@@ -83,50 +69,39 @@ proto.execute = function execute(executeMessage) {
|
|
|
83
69
|
broker.bindQueue(execQ.name, 'execution', 'execute.detach');
|
|
84
70
|
broker.bindQueue(execQ.name, 'execution', 'execute.bound.completed');
|
|
85
71
|
broker.bindQueue(execQ.name, 'execution', 'execute.repeat');
|
|
86
|
-
|
|
87
72
|
if (eventDefinitionExecution && !this.environment.settings.strict) {
|
|
88
73
|
broker.bindQueue(execQ.name, 'execution', 'execute.expect');
|
|
89
74
|
}
|
|
90
|
-
|
|
91
75
|
execQ.consume(this._onExecutionMessage.bind(this), {
|
|
92
76
|
consumerTag: '_execution-tag'
|
|
93
77
|
});
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
if (eventDefinitionExecution) {
|
|
97
80
|
return eventDefinitionExecution.execute(executeMessage);
|
|
98
81
|
}
|
|
99
82
|
};
|
|
100
|
-
|
|
101
83
|
proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
102
84
|
message.ack();
|
|
103
|
-
|
|
104
85
|
switch (routingKey) {
|
|
105
86
|
case 'execute.detach':
|
|
106
87
|
return this._onDetachMessage(routingKey, message);
|
|
107
|
-
|
|
108
88
|
case 'execute.bound.completed':
|
|
109
89
|
return this._onCompleted(routingKey, message);
|
|
110
|
-
|
|
111
90
|
case 'execute.repeat':
|
|
112
91
|
return this._onRepeatMessage(routingKey, message);
|
|
113
|
-
|
|
114
92
|
case 'execute.expect':
|
|
115
93
|
return this._onExpectMessage(routingKey, message);
|
|
116
94
|
}
|
|
117
95
|
};
|
|
118
|
-
|
|
119
96
|
proto._onCompleted = function onCompleted(_, {
|
|
120
97
|
content
|
|
121
98
|
}) {
|
|
122
99
|
if (!this.cancelActivity && !content.cancelActivity) {
|
|
123
100
|
this._stop();
|
|
124
|
-
|
|
125
101
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content, {
|
|
126
102
|
cancelActivity: false
|
|
127
103
|
}));
|
|
128
104
|
}
|
|
129
|
-
|
|
130
105
|
this[kCompleteContent] = content;
|
|
131
106
|
const inbound = this[kExecuteMessage].content.inbound;
|
|
132
107
|
const attachedToContent = inbound && inbound[0];
|
|
@@ -136,19 +111,15 @@ proto._onCompleted = function onCompleted(_, {
|
|
|
136
111
|
content: attachedToContent
|
|
137
112
|
}).discard();
|
|
138
113
|
};
|
|
139
|
-
|
|
140
114
|
proto._onAttachedLeave = function onAttachedLeave(_, {
|
|
141
115
|
content
|
|
142
116
|
}) {
|
|
143
117
|
if (content.id !== this.attachedTo.id) return;
|
|
144
|
-
|
|
145
118
|
this._stop();
|
|
146
|
-
|
|
147
119
|
const completeContent = this[kCompleteContent];
|
|
148
120
|
if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[kExecuteMessage].content);
|
|
149
121
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
|
|
150
122
|
};
|
|
151
|
-
|
|
152
123
|
proto._onExpectMessage = function onExpectMessage(_, {
|
|
153
124
|
content
|
|
154
125
|
}) {
|
|
@@ -168,17 +139,14 @@ proto._onExpectMessage = function onExpectMessage(_, {
|
|
|
168
139
|
priority: 300
|
|
169
140
|
});
|
|
170
141
|
};
|
|
171
|
-
|
|
172
142
|
proto._onDetachMessage = function onDetachMessage(_, {
|
|
173
143
|
content
|
|
174
144
|
}) {
|
|
175
145
|
const id = this.id,
|
|
176
|
-
|
|
177
|
-
|
|
146
|
+
executionId = this.executionId,
|
|
147
|
+
attachedTo = this.attachedTo;
|
|
178
148
|
this.activity.logger.debug(`<${executionId} (${id})> detach from activity <${attachedTo.id}>`);
|
|
179
|
-
|
|
180
149
|
this._stop(true);
|
|
181
|
-
|
|
182
150
|
const {
|
|
183
151
|
executionId: detachId,
|
|
184
152
|
bindExchange,
|
|
@@ -201,23 +169,19 @@ proto._onDetachMessage = function onDetachMessage(_, {
|
|
|
201
169
|
content: completeContent
|
|
202
170
|
}) => {
|
|
203
171
|
this._stop();
|
|
204
|
-
|
|
205
172
|
this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
|
|
206
173
|
}, {
|
|
207
174
|
consumerTag: `_execution-completed-${executionId}`
|
|
208
175
|
});
|
|
209
176
|
};
|
|
210
|
-
|
|
211
177
|
proto._onApiMessage = function onApiMessage(_, message) {
|
|
212
178
|
switch (message.properties.type) {
|
|
213
179
|
case 'discard':
|
|
214
180
|
case 'stop':
|
|
215
181
|
this._stop();
|
|
216
|
-
|
|
217
182
|
break;
|
|
218
183
|
}
|
|
219
184
|
};
|
|
220
|
-
|
|
221
185
|
proto._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
222
186
|
if (this.cancelActivity) return;
|
|
223
187
|
const executeMessage = this[kExecuteMessage];
|
|
@@ -228,16 +192,12 @@ proto._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
|
228
192
|
repeat
|
|
229
193
|
}));
|
|
230
194
|
};
|
|
231
|
-
|
|
232
195
|
proto._stop = function stop(detach) {
|
|
233
196
|
const attachedTo = this.attachedTo,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
197
|
+
broker = this.broker,
|
|
198
|
+
executionId = this.executionId;
|
|
237
199
|
for (const tag of this[kAttachedTags].splice(0)) attachedTo.broker.cancel(tag);
|
|
238
|
-
|
|
239
200
|
for (const shovelName of this[kShovels].splice(0)) attachedTo.broker.closeShovel(shovelName);
|
|
240
|
-
|
|
241
201
|
broker.cancel('_execution-tag');
|
|
242
202
|
broker.cancel(`_execution-completed-${executionId}`);
|
|
243
203
|
if (detach) return;
|
|
@@ -5,36 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.EndEventBehaviour = EndEventBehaviour;
|
|
7
7
|
exports.default = EndEvent;
|
|
8
|
-
|
|
9
8
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
|
-
|
|
11
9
|
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
12
|
-
|
|
13
10
|
var _messageHelper = require("../messageHelper");
|
|
14
|
-
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
12
|
const kExecution = Symbol.for('execution');
|
|
18
|
-
|
|
19
13
|
function EndEvent(activityDef, context) {
|
|
20
|
-
return new _Activity.default(EndEventBehaviour, {
|
|
14
|
+
return new _Activity.default(EndEventBehaviour, {
|
|
15
|
+
...activityDef,
|
|
21
16
|
isThrowing: true
|
|
22
17
|
}, context);
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
function EndEventBehaviour(activity) {
|
|
26
20
|
this.id = activity.id;
|
|
27
21
|
this.type = activity.type;
|
|
28
22
|
this.broker = activity.broker;
|
|
29
23
|
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
EndEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
33
26
|
const execution = this[kExecution];
|
|
34
|
-
|
|
35
27
|
if (execution) {
|
|
36
28
|
return execution.execute(executeMessage);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
40
31
|
};
|
|
@@ -5,35 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.IntermediateCatchEventBehaviour = IntermediateCatchEventBehaviour;
|
|
7
7
|
exports.default = IntermediateCatchEvent;
|
|
8
|
-
|
|
9
8
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
|
-
|
|
11
9
|
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
12
|
-
|
|
13
10
|
var _messageHelper = require("../messageHelper");
|
|
14
|
-
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
12
|
const kExecution = Symbol.for('execution');
|
|
18
|
-
|
|
19
13
|
function IntermediateCatchEvent(activityDef, context) {
|
|
20
14
|
return new _Activity.default(IntermediateCatchEventBehaviour, activityDef, context);
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
function IntermediateCatchEventBehaviour(activity) {
|
|
24
17
|
this.id = activity.id;
|
|
25
18
|
this.type = activity.type;
|
|
26
19
|
this.broker = activity.broker;
|
|
27
20
|
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
IntermediateCatchEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
31
23
|
const execution = this[kExecution];
|
|
32
|
-
|
|
33
24
|
if (execution) {
|
|
34
25
|
return execution.execute(executeMessage);
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
const executeContent = executeMessage.content;
|
|
38
28
|
const executionId = executeContent.executionId;
|
|
39
29
|
const broker = this.broker;
|
|
@@ -43,7 +33,6 @@ IntermediateCatchEventBehaviour.prototype.execute = function execute(executeMess
|
|
|
43
33
|
});
|
|
44
34
|
return broker.publish('event', 'activity.wait', (0, _messageHelper.cloneContent)(executeContent));
|
|
45
35
|
};
|
|
46
|
-
|
|
47
36
|
IntermediateCatchEventBehaviour.prototype._onApiMessage = function onApiMessage(executeMessage, routingKey, message) {
|
|
48
37
|
switch (message.properties.type) {
|
|
49
38
|
case 'message':
|
|
@@ -55,14 +44,12 @@ IntermediateCatchEventBehaviour.prototype._onApiMessage = function onApiMessage(
|
|
|
55
44
|
output: message.content.message
|
|
56
45
|
}));
|
|
57
46
|
}
|
|
58
|
-
|
|
59
47
|
case 'discard':
|
|
60
48
|
{
|
|
61
49
|
const broker = this.broker;
|
|
62
50
|
broker.cancel('_api-behaviour-execution');
|
|
63
51
|
return broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
64
52
|
}
|
|
65
|
-
|
|
66
53
|
case 'stop':
|
|
67
54
|
{
|
|
68
55
|
return this.broker.cancel('_api-behaviour-execution');
|
|
@@ -5,36 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.IntermediateThrowEventBehaviour = IntermediateThrowEventBehaviour;
|
|
7
7
|
exports.default = IntermediateThrowEvent;
|
|
8
|
-
|
|
9
8
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
|
-
|
|
11
9
|
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
12
|
-
|
|
13
10
|
var _messageHelper = require("../messageHelper");
|
|
14
|
-
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
12
|
const kExecution = Symbol.for('execution');
|
|
18
|
-
|
|
19
13
|
function IntermediateThrowEvent(activityDef, context) {
|
|
20
|
-
return new _Activity.default(IntermediateThrowEventBehaviour, {
|
|
14
|
+
return new _Activity.default(IntermediateThrowEventBehaviour, {
|
|
15
|
+
...activityDef,
|
|
21
16
|
isThrowing: true
|
|
22
17
|
}, context);
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
function IntermediateThrowEventBehaviour(activity) {
|
|
26
20
|
this.id = activity.id;
|
|
27
21
|
this.type = activity.type;
|
|
28
22
|
this.broker = activity.broker;
|
|
29
23
|
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
IntermediateThrowEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
33
26
|
const execution = this[kExecution];
|
|
34
|
-
|
|
35
27
|
if (execution) {
|
|
36
28
|
return execution.execute(executeMessage);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
40
31
|
};
|