bpmn-elements 16.2.1 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/MessageFormatter.js +47 -47
  2. package/dist/activity/Activity.js +14 -9
  3. package/dist/getPropertyValue.js +1 -2
  4. package/dist/tasks/CallActivity.js +7 -2
  5. package/package.json +6 -6
  6. package/src/Api.js +6 -8
  7. package/src/EventBroker.js +5 -7
  8. package/src/MessageFormatter.js +48 -54
  9. package/src/activity/Activity.js +16 -15
  10. package/src/activity/ActivityExecution.js +2 -2
  11. package/src/activity/outbound-evaluator.js +1 -1
  12. package/src/definition/Definition.js +2 -2
  13. package/src/definition/DefinitionExecution.js +7 -7
  14. package/src/error/Errors.js +6 -8
  15. package/src/eventDefinitions/CancelEventDefinition.js +1 -1
  16. package/src/eventDefinitions/CompensateEventDefinition.js +1 -1
  17. package/src/eventDefinitions/ConditionalEventDefinition.js +2 -2
  18. package/src/eventDefinitions/ErrorEventDefinition.js +3 -3
  19. package/src/eventDefinitions/LinkEventDefinition.js +1 -1
  20. package/src/eventDefinitions/MessageEventDefinition.js +2 -2
  21. package/src/eventDefinitions/SignalEventDefinition.js +2 -2
  22. package/src/eventDefinitions/TimerEventDefinition.js +2 -2
  23. package/src/events/BoundaryEvent.js +6 -6
  24. package/src/events/IntermediateCatchEvent.js +1 -1
  25. package/src/events/StartEvent.js +2 -2
  26. package/src/flows/MessageFlow.js +1 -1
  27. package/src/getPropertyValue.js +1 -3
  28. package/src/io/InputOutputSpecification.js +2 -2
  29. package/src/io/Properties.js +4 -4
  30. package/src/messageHelper.js +6 -8
  31. package/src/process/Process.js +1 -1
  32. package/src/process/ProcessExecution.js +8 -8
  33. package/src/tasks/CallActivity.js +18 -14
  34. package/src/tasks/LoopCharacteristics.js +1 -1
  35. package/src/tasks/ReceiveTask.js +2 -2
  36. package/src/tasks/ScriptTask.js +2 -2
  37. package/src/tasks/ServiceTask.js +1 -1
  38. package/src/tasks/SignalTask.js +4 -4
  39. package/types/types.d.ts +9 -1
@@ -439,7 +439,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
439
439
  executionId: calledFrom.executionId,
440
440
  error: content.error,
441
441
  },
442
- { mandatory: true, type: 'error' },
442
+ { mandatory: true, type: 'error' }
443
443
  );
444
444
  } else {
445
445
  for (const bp of new Set(this[kProcesses].running)) {
@@ -502,7 +502,7 @@ DefinitionExecution.prototype._onStopped = function onStopped(message) {
502
502
  cloneContent(this[kExecuteMessage].content, {
503
503
  ...message.content,
504
504
  }),
505
- { type: 'stopped', persistent: false },
505
+ { type: 'stopped', persistent: false }
506
506
  );
507
507
  };
508
508
 
@@ -563,7 +563,7 @@ DefinitionExecution.prototype._onMessageOutbound = function onMessageOutbound(ro
563
563
 
564
564
  this._debug(
565
565
  `conveying message from <${source.processId}.${source.id}> to`,
566
- target.id ? `<${target.processId}.${target.id}>` : `<${target.processId}>`,
566
+ target.id ? `<${target.processId}.${target.id}>` : `<${target.processId}>`
567
567
  );
568
568
 
569
569
  const targetProcesses = this.getProcessesById(target.processId);
@@ -654,7 +654,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
654
654
  const message = reference?.resolve(executeMessage);
655
655
 
656
656
  this._debug(
657
- `<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating.`,
657
+ `<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating.`
658
658
  );
659
659
 
660
660
  this.getApi().sendApiMessage(
@@ -669,7 +669,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
669
669
  message,
670
670
  originalMessage: content.message,
671
671
  },
672
- { delegate: true, type: messageType },
672
+ { delegate: true, type: messageType }
673
673
  );
674
674
 
675
675
  this.broker.publish(
@@ -678,7 +678,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
678
678
  this._createMessage({
679
679
  message: message && cloneContent(message),
680
680
  }),
681
- { type: messageType },
681
+ { type: messageType }
682
682
  );
683
683
  };
684
684
 
@@ -706,7 +706,7 @@ DefinitionExecution.prototype._complete = function complete(completionType, cont
706
706
  ...content,
707
707
  state: completionType,
708
708
  },
709
- { type: completionType, mandatory: completionType === 'error', ...options },
709
+ { type: completionType, mandatory: completionType === 'error', ...options }
710
710
  );
711
711
  };
712
712
 
@@ -1,6 +1,6 @@
1
1
  import { cloneMessage } from '../messageHelper.js';
2
2
 
3
- class ActivityError extends Error {
3
+ export class ActivityError extends Error {
4
4
  constructor(description, sourceMessage, inner) {
5
5
  super(description);
6
6
  this.type = 'ActivityError';
@@ -15,14 +15,14 @@ class ActivityError extends Error {
15
15
  }
16
16
  }
17
17
 
18
- class RunError extends ActivityError {
18
+ export class RunError extends ActivityError {
19
19
  constructor(...args) {
20
20
  super(...args);
21
21
  this.type = 'RunError';
22
22
  }
23
23
  }
24
24
 
25
- class BpmnError extends Error {
25
+ export class BpmnError extends Error {
26
26
  constructor(description, behaviour, sourceMessage, inner) {
27
27
  super(description);
28
28
  this.type = 'BpmnError';
@@ -35,9 +35,7 @@ class BpmnError extends Error {
35
35
  }
36
36
  }
37
37
 
38
- export { ActivityError, BpmnError, RunError, makeErrorFromMessage };
39
-
40
- function makeErrorFromMessage(errorMessage) {
38
+ export function makeErrorFromMessage(errorMessage) {
41
39
  const { content } = errorMessage;
42
40
 
43
41
  if (isKnownError(content)) return content;
@@ -52,13 +50,13 @@ function makeErrorFromMessage(errorMessage) {
52
50
  return new ActivityError(
53
51
  error.message || error.description,
54
52
  error.source,
55
- error.inner ? error.inner : { code: error.code, name: error.name },
53
+ error.inner ? error.inner : { code: error.code, name: error.name }
56
54
  );
57
55
  case 'RunError':
58
56
  return new RunError(
59
57
  error.message || error.description,
60
58
  error.source,
61
- error.inner ? error.inner : { code: error.code, name: error.name },
59
+ error.inner ? error.inner : { code: error.code, name: error.name }
62
60
  );
63
61
  case 'BpmnError':
64
62
  return new BpmnError(error.message || error.description, error, error.source);
@@ -56,7 +56,7 @@ CancelEventDefinition.prototype.executeCatch = function executeCatch(executeMess
56
56
  pattern: 'activity.execution.cancel',
57
57
  exchange: 'execution',
58
58
  expectRoutingKey,
59
- }),
59
+ })
60
60
  );
61
61
 
62
62
  const waitContent = cloneContent(executeContent, {
@@ -79,7 +79,7 @@ CompensateEventDefinition.prototype.executeCatch = function executeCatch(execute
79
79
  sourceExchange: 'execution',
80
80
  bindExchange: 'compensate',
81
81
  expect: 'compensate',
82
- }),
82
+ })
83
83
  );
84
84
  };
85
85
 
@@ -95,7 +95,7 @@ ConditionalEventDefinition.prototype.evaluateCallback = function evaluateCallbac
95
95
  return broker.publish(
96
96
  'execution',
97
97
  'execute.error',
98
- cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true }),
98
+ cloneContent(executeContent, { error: new ActivityError(err.message, executeMessage, err) }, { mandatory: true })
99
99
  );
100
100
  }
101
101
 
@@ -106,7 +106,7 @@ ConditionalEventDefinition.prototype.evaluateCallback = function evaluateCallbac
106
106
  'activity.condition',
107
107
  cloneContent(this[kExecuteMessage].content, {
108
108
  conditionResult: result,
109
- }),
109
+ })
110
110
  );
111
111
 
112
112
  if (!result) return;
@@ -85,7 +85,7 @@ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessa
85
85
  exchange: 'execution',
86
86
  expectRoutingKey,
87
87
  expect: { ...info.message },
88
- }),
88
+ })
89
89
  );
90
90
 
91
91
  if (this[kCompleted]) return this._stop();
@@ -123,7 +123,7 @@ ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessa
123
123
  'execute.completed',
124
124
  cloneContent(executeContent, {
125
125
  message: { ...info.message },
126
- }),
126
+ })
127
127
  );
128
128
  };
129
129
 
@@ -178,7 +178,7 @@ ErrorEventDefinition.prototype._catchError = function catchError(routingKey, mes
178
178
  output: error,
179
179
  cancelActivity: true,
180
180
  state: 'catch',
181
- }),
181
+ })
182
182
  );
183
183
  };
184
184
 
@@ -168,7 +168,7 @@ LinkEventDefinition.prototype._onDiscard = function onDiscard(_, message) {
168
168
  message: { ...this.reference },
169
169
  state: 'discard',
170
170
  }),
171
- { type: 'link', delegate: true },
171
+ { type: 'link', delegate: true }
172
172
  );
173
173
  };
174
174
 
@@ -124,7 +124,7 @@ MessageEventDefinition.prototype._onCatchMessage = function onCatchMessage(routi
124
124
  {
125
125
  correlationId,
126
126
  type,
127
- },
127
+ }
128
128
  );
129
129
 
130
130
  this._complete('caught', message.content.message, { correlationId });
@@ -171,7 +171,7 @@ MessageEventDefinition.prototype._complete = function complete(verb, output, opt
171
171
  output,
172
172
  state: 'catch',
173
173
  }),
174
- options,
174
+ options
175
175
  );
176
176
  };
177
177
 
@@ -128,7 +128,7 @@ SignalEventDefinition.prototype._onCatchMessage = function onCatchMessage(routin
128
128
  {
129
129
  correlationId,
130
130
  type,
131
- },
131
+ }
132
132
  );
133
133
 
134
134
  return this._complete(message.content.message, message.properties);
@@ -164,7 +164,7 @@ SignalEventDefinition.prototype._complete = function complete(output, options) {
164
164
  output,
165
165
  state: 'signal',
166
166
  }),
167
- options,
167
+ options
168
168
  );
169
169
  };
170
170
 
@@ -153,7 +153,7 @@ TimerEventDefinition.prototype._onDelegatedApiMessage = function onDelegatedApiM
153
153
  ...content.message,
154
154
  },
155
155
  }),
156
- { correlationId, type },
156
+ { correlationId, type }
157
157
  );
158
158
 
159
159
  return this._onApiMessage(routingKey, message);
@@ -170,7 +170,7 @@ TimerEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey,
170
170
  state: 'cancel',
171
171
  ...(message.content.message && { message: message.content.message }),
172
172
  },
173
- { correlationId },
173
+ { correlationId }
174
174
  );
175
175
  }
176
176
  case 'stop': {
@@ -105,7 +105,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
105
105
  return this.broker.publish(
106
106
  'execution',
107
107
  'execute.completed',
108
- cloneContent(content, { isDefinitionScope: false, cancelActivity: false }),
108
+ cloneContent(content, { isDefinitionScope: false, cancelActivity: false })
109
109
  );
110
110
  }
111
111
 
@@ -116,7 +116,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
116
116
  const attachedTo = this.attachedTo;
117
117
 
118
118
  this.activity.logger.debug(
119
- `<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`,
119
+ `<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`
120
120
  );
121
121
 
122
122
  if (content.isRecovered && !attachedTo.isRunning) {
@@ -128,7 +128,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
128
128
  () => {
129
129
  attachedTo.getApi({ content: attachedToContent }).discard();
130
130
  },
131
- { consumerTag: attachedExecuteTag },
131
+ { consumerTag: attachedExecuteTag }
132
132
  );
133
133
  } else {
134
134
  attachedTo.getApi({ content: attachedToContent }).discard();
@@ -165,7 +165,7 @@ BoundaryEventBehaviour.prototype._onExpectMessage = function onExpectMessage(_,
165
165
  noAck: true,
166
166
  consumerTag: errorConsumerTag,
167
167
  priority: 400,
168
- },
168
+ }
169
169
  );
170
170
  };
171
171
 
@@ -195,7 +195,7 @@ BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_,
195
195
  },
196
196
  {
197
197
  cloneMessage,
198
- },
198
+ }
199
199
  );
200
200
 
201
201
  const detachContent = cloneContent(content, {
@@ -215,7 +215,7 @@ BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_,
215
215
  },
216
216
  {
217
217
  consumerTag: `_execution-completed-${executionId}`,
218
- },
218
+ }
219
219
  );
220
220
  };
221
221
 
@@ -43,7 +43,7 @@ IntermediateCatchEventBehaviour.prototype._onApiMessage = function onApiMessage(
43
43
  'execute.completed',
44
44
  cloneContent(executeMessage.content, {
45
45
  output: message.content.message,
46
- }),
46
+ })
47
47
  );
48
48
  }
49
49
  case 'discard': {
@@ -64,7 +64,7 @@ StartEventBehaviour.prototype._onApiMessage = function onApiMessage(routingKey,
64
64
  output: message.content.message,
65
65
  state: 'signal',
66
66
  }),
67
- { correlationId },
67
+ { correlationId }
68
68
  );
69
69
  }
70
70
  case 'discard': {
@@ -97,7 +97,7 @@ StartEventBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMe
97
97
  {
98
98
  correlationId,
99
99
  type,
100
- },
100
+ }
101
101
  );
102
102
 
103
103
  return this._onApiMessage(routingKey, message);
@@ -80,7 +80,7 @@ MessageFlow.prototype._onSourceEnd = function onSourceEnd({ content }) {
80
80
  const source = this.source;
81
81
  const target = this.target;
82
82
  this.logger.debug(
83
- `<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}>`,
83
+ `<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}>`
84
84
  );
85
85
  this.broker.publish('event', 'message.outbound', this._createMessageContent(content.message));
86
86
  };
@@ -3,9 +3,7 @@ const stringConstantPattern = /^(['"])(.*)\1$/;
3
3
  const numberConstantPattern = /^\W*-?\d+(.\d+)?\W*$/;
4
4
  const negativeIndexPattern = /^-\d+$/;
5
5
 
6
- export default getPropertyValue;
7
-
8
- function getPropertyValue(inputContext, propertyPath, fnScope) {
6
+ export default function getPropertyValue(inputContext, propertyPath, fnScope) {
9
7
  if (!inputContext) return;
10
8
 
11
9
  let resultValue;
@@ -71,7 +71,7 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
71
71
  {
72
72
  dataObjects: [],
73
73
  sources: [],
74
- },
74
+ }
75
75
  );
76
76
 
77
77
  if (!dataObjects.length) {
@@ -135,7 +135,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
135
135
  {
136
136
  dataObjects: [],
137
137
  sources: [],
138
- },
138
+ }
139
139
  );
140
140
 
141
141
  const startRoutingKey = `run.onend.${safeType}`;
@@ -94,7 +94,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
94
94
  { routingKey: startRoutingKey },
95
95
  {
96
96
  properties: this._getProperties(message),
97
- },
97
+ }
98
98
  );
99
99
  }
100
100
 
@@ -104,7 +104,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
104
104
  {
105
105
  endRoutingKey,
106
106
  properties: this._getProperties(message),
107
- },
107
+ }
108
108
  );
109
109
 
110
110
  return read(broker, [...dataInputObjects], (_, responses) => {
@@ -127,7 +127,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
127
127
  { routingKey: startRoutingKey },
128
128
  {
129
129
  properties: outputProperties,
130
- },
130
+ }
131
131
  );
132
132
  }
133
133
 
@@ -137,7 +137,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
137
137
  {
138
138
  endRoutingKey,
139
139
  properties: outputProperties,
140
- },
140
+ }
141
141
  );
142
142
 
143
143
  return write(broker, [...dataOutputObjects], outputProperties, (_, responses) => {
@@ -1,6 +1,4 @@
1
- export { cloneContent, cloneMessage, cloneParent, shiftParent, unshiftParent, pushParent };
2
-
3
- function cloneContent(content, extend) {
1
+ export function cloneContent(content, extend) {
4
2
  const { discardSequence, inbound, outbound, parent, sequence } = content;
5
3
 
6
4
  const clone = {
@@ -27,7 +25,7 @@ function cloneContent(content, extend) {
27
25
  return clone;
28
26
  }
29
27
 
30
- function cloneMessage(message, overrideContent) {
28
+ export function cloneMessage(message, overrideContent) {
31
29
  return {
32
30
  fields: { ...message.fields },
33
31
  content: cloneContent(message.content, overrideContent),
@@ -35,7 +33,7 @@ function cloneMessage(message, overrideContent) {
35
33
  };
36
34
  }
37
35
 
38
- function cloneParent(parent) {
36
+ export function cloneParent(parent) {
39
37
  const { path } = parent;
40
38
  const clone = { ...parent };
41
39
  if (!path) return clone;
@@ -47,7 +45,7 @@ function cloneParent(parent) {
47
45
  return clone;
48
46
  }
49
47
 
50
- function unshiftParent(parent, adoptingParent) {
48
+ export function unshiftParent(parent, adoptingParent) {
51
49
  const { id, type, executionId } = adoptingParent;
52
50
  if (!parent) {
53
51
  return {
@@ -69,7 +67,7 @@ function unshiftParent(parent, adoptingParent) {
69
67
  return clone;
70
68
  }
71
69
 
72
- function shiftParent(parent) {
70
+ export function shiftParent(parent) {
73
71
  if (!parent) return;
74
72
  if (!parent.path || !parent.path.length) return;
75
73
 
@@ -82,7 +80,7 @@ function shiftParent(parent) {
82
80
  return clone;
83
81
  }
84
82
 
85
- function pushParent(parent, ancestor) {
83
+ export function pushParent(parent, ancestor) {
86
84
  const { id, type, executionId } = ancestor;
87
85
  if (!parent) return { id, type, executionId };
88
86
 
@@ -274,7 +274,7 @@ Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
274
274
  'error',
275
275
  cloneContent(content, {
276
276
  error: fields.redelivered ? makeErrorFromMessage(message) : content.error,
277
- }),
277
+ })
278
278
  );
279
279
  break;
280
280
  }
@@ -266,7 +266,7 @@ ProcessExecution.prototype.shake = function shake(fromId) {
266
266
  }
267
267
  }
268
268
  },
269
- { noAck: true, consumerTag: `_shaker-${this.executionId}` },
269
+ { noAck: true, consumerTag: `_shaker-${this.executionId}` }
270
270
  );
271
271
 
272
272
  for (const a of toShake) a.shake();
@@ -301,7 +301,7 @@ ProcessExecution.prototype.discard = function discard() {
301
301
  type: this.type,
302
302
  executionId: this.executionId,
303
303
  },
304
- { type: 'discard' },
304
+ { type: 'discard' }
305
305
  );
306
306
  };
307
307
 
@@ -313,7 +313,7 @@ ProcessExecution.prototype.cancel = function discard() {
313
313
  type: this.type,
314
314
  executionId: this.executionId,
315
315
  },
316
- { type: 'cancel' },
316
+ { type: 'cancel' }
317
317
  );
318
318
  };
319
319
 
@@ -689,7 +689,7 @@ ProcessExecution.prototype._onChildCompleted = function onChildCompleted(message
689
689
  type: this.type,
690
690
  executionId: this.executionId,
691
691
  },
692
- { type: 'cancel' },
692
+ { type: 'cancel' }
693
693
  );
694
694
  }
695
695
 
@@ -722,7 +722,7 @@ ProcessExecution.prototype._stopExecution = function stopExecution(message) {
722
722
  ...this[kExecuteMessage].content,
723
723
  ...(message && message.content),
724
724
  },
725
- { type: 'stopped', persistent: false },
725
+ { type: 'stopped', persistent: false }
726
726
  );
727
727
  };
728
728
 
@@ -760,7 +760,7 @@ ProcessExecution.prototype._onCancel = function onCancel() {
760
760
  'transaction.cancel',
761
761
  cloneMessage(this[kExecuteMessage], {
762
762
  state: 'cancel',
763
- }),
763
+ })
764
764
  );
765
765
 
766
766
  for (const msg of running) {
@@ -817,7 +817,7 @@ ProcessExecution.prototype._delegateApiMessage = function delegateApiMessage(rou
817
817
  this._debug(`delegated api message was consumed by ${msg.content ? msg.content.executionId : 'unknown'}`);
818
818
  }
819
819
  },
820
- { consumerTag: `_ct-delegate-${correlationId}`, noAck: true },
820
+ { consumerTag: `_ct-delegate-${correlationId}`, noAck: true }
821
821
  );
822
822
 
823
823
  for (const child of this[kElements].children) {
@@ -858,7 +858,7 @@ ProcessExecution.prototype._complete = function complete(completionType, content
858
858
  ...content,
859
859
  state: completionType,
860
860
  }),
861
- { type: completionType, mandatory: completionType === 'error' },
861
+ { type: completionType, mandatory: completionType === 'error' }
862
862
  );
863
863
  };
864
864
 
@@ -8,7 +8,6 @@ export default function CallActivity(activityDef, context) {
8
8
 
9
9
  export function CallActivityBehaviour(activity) {
10
10
  const { id, type, behaviour = {} } = activity;
11
-
12
11
  this.id = id;
13
12
  this.type = type;
14
13
  this.calledElement = behaviour.calledElement;
@@ -40,8 +39,8 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
40
39
  },
41
40
  {
42
41
  mandatory: true,
43
- },
44
- ),
42
+ }
43
+ )
45
44
  );
46
45
  }
47
46
 
@@ -56,11 +55,15 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
56
55
  noAck: true,
57
56
  consumerTag: `_api-${executionId}`,
58
57
  priority: 300,
59
- },
58
+ }
60
59
  );
61
60
  broker.subscribeTmp('api', '#.signal.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
62
61
  noAck: true,
63
- consumerTag: `_api-delegated-${executionId}`,
62
+ consumerTag: `_api-delegated-signal-${executionId}`,
63
+ });
64
+ broker.subscribeTmp('api', '#.cancel.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
65
+ noAck: true,
66
+ consumerTag: `_api-delegated-cancel-${executionId}`,
64
67
  });
65
68
 
66
69
  broker.publish(
@@ -72,7 +75,7 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
72
75
  }),
73
76
  {
74
77
  type: 'call',
75
- },
78
+ }
76
79
  );
77
80
  };
78
81
 
@@ -80,7 +83,7 @@ CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApi
80
83
  calledElement,
81
84
  executeMessage,
82
85
  routingKey,
83
- message,
86
+ message
84
87
  ) {
85
88
  if (!message.properties.delegate) return;
86
89
  const { content: delegateContent } = message;
@@ -103,7 +106,7 @@ CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApi
103
106
  {
104
107
  correlationId,
105
108
  type: messageType,
106
- },
109
+ }
107
110
  );
108
111
 
109
112
  return this._onApiMessage(calledElement, executeMessage, routingKey, message);
@@ -126,7 +129,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
126
129
  }),
127
130
  {
128
131
  type: 'cancel',
129
- },
132
+ }
130
133
  );
131
134
  }
132
135
  case 'signal':
@@ -140,7 +143,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
140
143
  }),
141
144
  {
142
145
  correlationId,
143
- },
146
+ }
144
147
  );
145
148
  case 'error':
146
149
  this._stop(executeContent.executionId);
@@ -155,8 +158,8 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
155
158
  {
156
159
  mandatory: true,
157
160
  correlationId,
158
- },
159
- ),
161
+ }
162
+ )
160
163
  );
161
164
  case 'discard':
162
165
  return this.broker.publish(
@@ -168,7 +171,7 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
168
171
  }),
169
172
  {
170
173
  type: 'discard',
171
- },
174
+ }
172
175
  );
173
176
  }
174
177
  };
@@ -176,5 +179,6 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
176
179
  CallActivityBehaviour.prototype._stop = function stop(executionId) {
177
180
  const broker = this.broker;
178
181
  broker.cancel(`_api-${executionId}`);
179
- broker.cancel(`_api-delegated-${executionId}`);
182
+ broker.cancel(`_api-delegated-signal-${executionId}`);
183
+ broker.cancel(`_api-delegated-cancel-${executionId}`);
180
184
  };
@@ -326,7 +326,7 @@ Characteristics.prototype.subscribe = function subscribe(onIterationCompleteMess
326
326
  `activity.*.${this.parentExecutionId}`,
327
327
  this.onApiMessage,
328
328
  { noAck: true, consumerTag: '_api-multi-instance-tag' },
329
- { priority: 400 },
329
+ { priority: 400 }
330
330
  );
331
331
  this.broker.subscribeTmp('execution', 'execute.*', onComplete, {
332
332
  noAck: true,
@@ -163,7 +163,7 @@ ReceiveTaskExecution.prototype._setupMessageHandling = function setupMessageHand
163
163
  },
164
164
  {
165
165
  noAck: true,
166
- },
166
+ }
167
167
  );
168
168
  broker.subscribeTmp('api', `activity.stop.${executionId}`, this._onStopApiMessage.bind(this), {
169
169
  noAck: true,
@@ -180,7 +180,7 @@ ReceiveTaskExecution.prototype._setupMessageHandling = function setupMessageHand
180
180
  },
181
181
  {
182
182
  noAck: true,
183
- },
183
+ }
184
184
  );
185
185
  };
186
186