bpmn-elements 8.2.1 → 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 CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ # 8.2.2
5
+
6
+ - mitigate possible stack overflow error by not acking message before publishing a new one. Fix after fix #31
7
+
4
8
  # 8.2.1
5
9
 
6
10
  - fix resume on caught activity error throws #31
@@ -497,6 +497,14 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
497
497
  case 'execution.discard':
498
498
  message.ack();
499
499
  return this._onDiscard(message);
500
+ case 'activity.error.caught':
501
+ {
502
+ const prevMsg = this[kElements].postponed.find(msg => {
503
+ return msg.content.executionId === content.executionId;
504
+ });
505
+ if (!prevMsg) return message.ack();
506
+ break;
507
+ }
500
508
  case 'activity.compensation.end':
501
509
  case 'flow.looped':
502
510
  case 'activity.leave':
@@ -530,9 +538,11 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
530
538
  });
531
539
  if (eventCaughtBy) {
532
540
  this[kActivityQ].queueMessage({
533
- routingKey: 'activity.caught'
534
- }, (0, _messageHelper.cloneContent)(content), message.properties);
535
- message.ack();
541
+ routingKey: 'activity.error.caught'
542
+ }, (0, _messageHelper.cloneContent)(content), {
543
+ persistent: true,
544
+ ...message.properties
545
+ });
536
546
  return this._debug('error was caught');
537
547
  }
538
548
  return this._complete('error', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-elements",
3
- "version": "8.2.1",
3
+ "version": "8.2.2",
4
4
  "description": "Executable workflow elements based on BPMN 2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "index.js",
@@ -499,6 +499,13 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
499
499
  case 'execution.discard':
500
500
  message.ack();
501
501
  return this._onDiscard(message);
502
+ case 'activity.error.caught': {
503
+ const prevMsg = this[kElements].postponed.find((msg) => {
504
+ return msg.content.executionId === content.executionId;
505
+ });
506
+ if (!prevMsg) return message.ack();
507
+ break;
508
+ }
502
509
  case 'activity.compensation.end':
503
510
  case 'flow.looped':
504
511
  case 'activity.leave':
@@ -532,8 +539,7 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
532
539
  return msg.content.source && msg.content.source.executionId === content.executionId;
533
540
  });
534
541
  if (eventCaughtBy) {
535
- this[kActivityQ].queueMessage({routingKey: 'activity.caught'}, cloneContent(content), message.properties);
536
- message.ack();
542
+ this[kActivityQ].queueMessage({routingKey: 'activity.error.caught'}, cloneContent(content), {persistent: true, ...message.properties});
537
543
  return this._debug('error was caught');
538
544
  }
539
545
  return this._complete('error', {error: content.error});