bpmn-elements 6.0.1 → 8.0.1
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 +341 -0
- package/README.md +3 -0
- package/dist/index.js +52 -44
- package/dist/src/Api.js +77 -76
- package/dist/src/Context.js +176 -172
- package/dist/src/Environment.js +110 -102
- package/dist/src/EventBroker.js +89 -88
- package/dist/src/ExtensionsMapper.js +2 -2
- package/dist/src/MessageFormatter.js +164 -95
- package/dist/src/Scripts.js +6 -2
- package/dist/src/activity/Activity.js +1105 -916
- package/dist/src/activity/ActivityExecution.js +342 -297
- package/dist/src/activity/Dummy.js +3 -3
- package/dist/src/definition/Definition.js +498 -444
- package/dist/src/definition/DefinitionExecution.js +710 -408
- package/dist/src/error/Errors.js +17 -7
- package/dist/src/eventDefinitions/CancelEventDefinition.js +190 -150
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +194 -161
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +197 -135
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +207 -165
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +175 -141
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +157 -129
- package/dist/src/eventDefinitions/LinkEventDefinition.js +174 -149
- package/dist/src/eventDefinitions/MessageEventDefinition.js +213 -176
- package/dist/src/eventDefinitions/SignalEventDefinition.js +203 -161
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +21 -23
- package/dist/src/eventDefinitions/TimerEventDefinition.js +243 -228
- package/dist/src/events/BoundaryEvent.js +180 -144
- package/dist/src/events/EndEvent.js +18 -23
- package/dist/src/events/IntermediateCatchEvent.js +44 -58
- package/dist/src/events/IntermediateThrowEvent.js +18 -23
- package/dist/src/events/StartEvent.js +109 -94
- package/dist/src/flows/Association.js +94 -100
- package/dist/src/flows/MessageFlow.js +86 -103
- package/dist/src/flows/SequenceFlow.js +173 -182
- package/dist/src/gateways/EventBasedGateway.js +88 -84
- package/dist/src/gateways/ExclusiveGateway.js +13 -16
- package/dist/src/gateways/InclusiveGateway.js +11 -14
- package/dist/src/gateways/ParallelGateway.js +11 -14
- package/dist/src/getPropertyValue.js +34 -34
- package/dist/src/io/BpmnIO.js +17 -14
- package/dist/src/io/EnvironmentDataObject.js +33 -29
- package/dist/src/io/EnvironmentDataStore.js +33 -29
- package/dist/src/io/EnvironmentDataStoreReference.js +35 -31
- package/dist/src/io/InputOutputSpecification.js +177 -168
- package/dist/src/io/Properties.js +117 -124
- package/dist/src/messageHelper.js +1 -1
- package/dist/src/process/Process.js +439 -362
- package/dist/src/process/ProcessExecution.js +748 -646
- package/dist/src/shared.js +2 -2
- package/dist/src/tasks/CallActivity.js +160 -0
- package/dist/src/tasks/LoopCharacteristics.js +309 -330
- package/dist/src/tasks/ReceiveTask.js +233 -182
- package/dist/src/tasks/ScriptTask.js +35 -41
- package/dist/src/tasks/ServiceImplementation.js +13 -20
- package/dist/src/tasks/ServiceTask.js +82 -75
- package/dist/src/tasks/SignalTask.js +97 -93
- package/dist/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/dist/src/tasks/SubProcess.js +193 -175
- package/dist/src/tasks/Task.js +17 -19
- package/index.js +2 -0
- package/package.json +16 -16
- package/src/Api.js +65 -59
- package/src/Context.js +145 -140
- package/src/Environment.js +116 -100
- package/src/EventBroker.js +67 -68
- package/src/ExtensionsMapper.js +2 -2
- package/src/MessageFormatter.js +132 -74
- package/src/activity/Activity.js +914 -776
- package/src/activity/ActivityExecution.js +293 -247
- package/src/activity/Dummy.js +2 -2
- package/src/definition/Definition.js +437 -401
- package/src/definition/DefinitionExecution.js +598 -340
- package/src/error/Errors.js +11 -6
- package/src/eventDefinitions/CancelEventDefinition.js +164 -121
- package/src/eventDefinitions/CompensateEventDefinition.js +159 -124
- package/src/eventDefinitions/ConditionalEventDefinition.js +147 -104
- package/src/eventDefinitions/ErrorEventDefinition.js +190 -131
- package/src/eventDefinitions/EscalationEventDefinition.js +139 -101
- package/src/eventDefinitions/EventDefinitionExecution.js +127 -95
- package/src/eventDefinitions/LinkEventDefinition.js +160 -129
- package/src/eventDefinitions/MessageEventDefinition.js +178 -121
- package/src/eventDefinitions/SignalEventDefinition.js +162 -106
- package/src/eventDefinitions/TerminateEventDefinition.js +19 -19
- package/src/eventDefinitions/TimerEventDefinition.js +202 -167
- package/src/events/BoundaryEvent.js +156 -115
- package/src/events/EndEvent.js +15 -18
- package/src/events/IntermediateCatchEvent.js +40 -44
- package/src/events/IntermediateThrowEvent.js +15 -18
- package/src/events/StartEvent.js +84 -50
- package/src/flows/Association.js +98 -112
- package/src/flows/MessageFlow.js +81 -97
- package/src/flows/SequenceFlow.js +146 -160
- package/src/gateways/EventBasedGateway.js +75 -68
- package/src/gateways/ExclusiveGateway.js +8 -13
- package/src/gateways/InclusiveGateway.js +8 -13
- package/src/gateways/ParallelGateway.js +8 -13
- package/src/getPropertyValue.js +34 -33
- package/src/io/BpmnIO.js +20 -15
- package/src/io/EnvironmentDataObject.js +29 -18
- package/src/io/EnvironmentDataStore.js +29 -18
- package/src/io/EnvironmentDataStoreReference.js +31 -20
- package/src/io/InputOutputSpecification.js +154 -157
- package/src/io/Properties.js +95 -97
- package/src/process/Process.js +378 -333
- package/src/process/ProcessExecution.js +603 -553
- package/src/tasks/CallActivity.js +130 -0
- package/src/tasks/LoopCharacteristics.js +290 -289
- package/src/tasks/ReceiveTask.js +174 -107
- package/src/tasks/ScriptTask.js +27 -30
- package/src/tasks/ServiceImplementation.js +13 -18
- package/src/tasks/ServiceTask.js +67 -60
- package/src/tasks/SignalTask.js +77 -52
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +184 -157
- package/src/tasks/Task.js +15 -19
package/dist/src/Environment.js
CHANGED
|
@@ -13,122 +13,130 @@ var _Timers = require("./Timers");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const kServices = Symbol.for('services');
|
|
17
|
+
const kVariables = Symbol.for('variables');
|
|
18
|
+
const defaultOptions = ['expressions', 'extensions', 'Logger', 'output', 'scripts', 'services', 'settings', 'timers', 'variables'];
|
|
17
19
|
|
|
18
20
|
function Environment(options = {}) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
this.options = validateOptions(options);
|
|
22
|
+
this.expressions = options.expressions || (0, _Expressions.default)();
|
|
23
|
+
this.extensions = options.extensions;
|
|
24
|
+
this.output = options.output || {};
|
|
25
|
+
this.scripts = options.scripts || (0, _Scripts.Scripts)();
|
|
26
|
+
this.timers = options.timers || (0, _Timers.Timers)();
|
|
27
|
+
this.settings = { ...options.settings
|
|
22
28
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const expressions = options.expressions || (0, _Expressions.default)();
|
|
28
|
-
const Logger = options.Logger || DummyLogger;
|
|
29
|
-
const extensions = options.extensions;
|
|
30
|
-
const environmentApi = {
|
|
31
|
-
options: initialOptions,
|
|
32
|
-
expressions,
|
|
33
|
-
extensions,
|
|
34
|
-
output,
|
|
35
|
-
scripts,
|
|
36
|
-
services,
|
|
37
|
-
settings,
|
|
38
|
-
timers,
|
|
39
|
-
|
|
40
|
-
get variables() {
|
|
41
|
-
return variables;
|
|
42
|
-
},
|
|
29
|
+
this.Logger = options.Logger || DummyLogger;
|
|
30
|
+
this[kServices] = options.services || {};
|
|
31
|
+
this[kVariables] = options.variables || {};
|
|
32
|
+
}
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getScript,
|
|
48
|
-
getServiceByName,
|
|
49
|
-
getState,
|
|
50
|
-
registerScript,
|
|
51
|
-
resolveExpression,
|
|
52
|
-
recover,
|
|
53
|
-
Logger
|
|
54
|
-
};
|
|
55
|
-
return environmentApi;
|
|
56
|
-
|
|
57
|
-
function getState() {
|
|
58
|
-
return {
|
|
59
|
-
settings: { ...settings
|
|
60
|
-
},
|
|
61
|
-
variables: { ...variables
|
|
62
|
-
},
|
|
63
|
-
output: { ...output
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
34
|
+
const proto = Environment.prototype;
|
|
35
|
+
Object.defineProperty(proto, 'variables', {
|
|
36
|
+
enumerable: true,
|
|
67
37
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const recoverOptions = validateOptions(state);
|
|
71
|
-
Object.assign(options, recoverOptions);
|
|
72
|
-
if (state.settings) Object.assign(settings, state.settings);
|
|
73
|
-
if (state.variables) Object.assign(variables, state.variables);
|
|
74
|
-
if (state.output) Object.assign(output, state.output);
|
|
75
|
-
return environmentApi;
|
|
38
|
+
get() {
|
|
39
|
+
return this[kVariables];
|
|
76
40
|
}
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
variables: { ...variables
|
|
83
|
-
},
|
|
84
|
-
output: { ...output
|
|
85
|
-
},
|
|
86
|
-
Logger,
|
|
87
|
-
extensions,
|
|
88
|
-
scripts,
|
|
89
|
-
timers,
|
|
90
|
-
expressions,
|
|
91
|
-
...initialOptions,
|
|
92
|
-
...overrideOptions,
|
|
93
|
-
services
|
|
94
|
-
};
|
|
95
|
-
if (overrideOptions.services) newOptions.services = { ...services,
|
|
96
|
-
...overrideOptions.services
|
|
97
|
-
};
|
|
98
|
-
return Environment(newOptions);
|
|
99
|
-
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(proto, 'services', {
|
|
44
|
+
enumerable: true,
|
|
100
45
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
...newVars
|
|
105
|
-
};
|
|
106
|
-
}
|
|
46
|
+
get() {
|
|
47
|
+
return this[kServices];
|
|
48
|
+
},
|
|
107
49
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
50
|
+
set(value) {
|
|
51
|
+
const services = this[kServices];
|
|
111
52
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
53
|
+
for (const name in services) {
|
|
54
|
+
if (!(name in value)) delete services[name];
|
|
55
|
+
}
|
|
115
56
|
|
|
116
|
-
|
|
117
|
-
return services[serviceName];
|
|
57
|
+
Object.assign(services, value);
|
|
118
58
|
}
|
|
119
59
|
|
|
120
|
-
|
|
121
|
-
const from = {
|
|
122
|
-
environment: environmentApi,
|
|
123
|
-
...message
|
|
124
|
-
};
|
|
125
|
-
return expressions.resolveExpression(expression, from, expressionFnContext);
|
|
126
|
-
}
|
|
60
|
+
});
|
|
127
61
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
62
|
+
proto.getState = function getState() {
|
|
63
|
+
return {
|
|
64
|
+
settings: { ...this.settings
|
|
65
|
+
},
|
|
66
|
+
variables: { ...this[kVariables]
|
|
67
|
+
},
|
|
68
|
+
output: { ...this.output
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
proto.recover = function recover(state) {
|
|
74
|
+
if (!state) return this;
|
|
75
|
+
if (state.settings) Object.assign(this.settings, state.settings);
|
|
76
|
+
if (state.variables) Object.assign(this[kVariables], state.variables);
|
|
77
|
+
if (state.output) Object.assign(this.output, state.output);
|
|
78
|
+
return this;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
proto.clone = function clone(overrideOptions = {}) {
|
|
82
|
+
const services = this[kServices];
|
|
83
|
+
const newOptions = {
|
|
84
|
+
settings: { ...this.settings
|
|
85
|
+
},
|
|
86
|
+
variables: { ...this[kVariables]
|
|
87
|
+
},
|
|
88
|
+
Logger: this.Logger,
|
|
89
|
+
extensions: this.extensions,
|
|
90
|
+
scripts: this.scripts,
|
|
91
|
+
timers: this.timers,
|
|
92
|
+
expressions: this.expressions,
|
|
93
|
+
...this.options,
|
|
94
|
+
...overrideOptions,
|
|
95
|
+
services
|
|
96
|
+
};
|
|
97
|
+
if (overrideOptions.services) newOptions.services = { ...services,
|
|
98
|
+
...overrideOptions.services
|
|
99
|
+
};
|
|
100
|
+
return new this.constructor(newOptions);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
proto.assignVariables = function assignVariables(newVars) {
|
|
104
|
+
if (!newVars || typeof newVars !== 'object') return;
|
|
105
|
+
this[kVariables] = { ...this.variables,
|
|
106
|
+
...newVars
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
proto.assignSettings = function assignVariables(newSettings) {
|
|
111
|
+
if (!newSettings || typeof newSettings !== 'object') return;
|
|
112
|
+
this.settings = { ...this.settings,
|
|
113
|
+
...newSettings
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
proto.getScript = function getScript(...args) {
|
|
118
|
+
return this.scripts.getScript(...args);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
proto.registerScript = function registerScript(...args) {
|
|
122
|
+
return this.scripts.register(...args);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
proto.getServiceByName = function getServiceByName(serviceName) {
|
|
126
|
+
return this[kServices][serviceName];
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
proto.resolveExpression = function resolveExpression(expression, message = {}, expressionFnContext) {
|
|
130
|
+
const from = {
|
|
131
|
+
environment: this,
|
|
132
|
+
...message
|
|
133
|
+
};
|
|
134
|
+
return this.expressions.resolveExpression(expression, from, expressionFnContext);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
proto.addService = function addService(name, fn) {
|
|
138
|
+
this[kServices][name] = fn;
|
|
139
|
+
};
|
|
132
140
|
|
|
133
141
|
function validateOptions(input) {
|
|
134
142
|
const options = {};
|
package/dist/src/EventBroker.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ActivityBroker = ActivityBroker;
|
|
7
7
|
exports.DefinitionBroker = DefinitionBroker;
|
|
8
|
+
exports.EventBroker = EventBroker;
|
|
8
9
|
exports.MessageFlowBroker = MessageFlowBroker;
|
|
9
10
|
exports.ProcessBroker = ProcessBroker;
|
|
10
|
-
exports.EventBroker = EventBroker;
|
|
11
11
|
|
|
12
12
|
var _smqp = require("smqp");
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ function DefinitionBroker(owner, onBrokerReturn) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function MessageFlowBroker(owner) {
|
|
30
|
-
const eventBroker = EventBroker(owner, {
|
|
30
|
+
const eventBroker = new EventBroker(owner, {
|
|
31
31
|
prefix: 'messageflow',
|
|
32
32
|
autoDelete: false,
|
|
33
33
|
durable: false
|
|
@@ -46,7 +46,7 @@ function MessageFlowBroker(owner) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
|
|
49
|
-
const eventBroker = EventBroker(brokerOwner, {
|
|
49
|
+
const eventBroker = new EventBroker(brokerOwner, {
|
|
50
50
|
prefix,
|
|
51
51
|
autoDelete: false,
|
|
52
52
|
durable: false
|
|
@@ -84,104 +84,105 @@ function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function EventBroker(brokerOwner, options, onBrokerReturn) {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
this.options = options;
|
|
88
|
+
this.eventPrefix = options.prefix;
|
|
89
|
+
const broker = this.broker = (0, _smqp.Broker)(brokerOwner);
|
|
89
90
|
broker.assertExchange('event', 'topic', options);
|
|
90
|
-
broker.on('return', onBrokerReturn
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
emit,
|
|
98
|
-
emitFatal
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
function on(eventName, callback, eventOptions = {
|
|
102
|
-
once: false
|
|
103
|
-
}) {
|
|
104
|
-
const key = getEventRoutingKey(eventName);
|
|
105
|
-
if (eventOptions.once) return broker.subscribeOnce('event', key, eventCallback, eventOptions);
|
|
106
|
-
return broker.subscribeTmp('event', key, eventCallback, { ...eventOptions,
|
|
107
|
-
noAck: true
|
|
108
|
-
});
|
|
91
|
+
broker.on('return', onBrokerReturn ? onBrokerReturn.bind(brokerOwner) : this._onBrokerReturnFn.bind(this));
|
|
92
|
+
this.on = this.on.bind(this);
|
|
93
|
+
this.once = this.once.bind(this);
|
|
94
|
+
this.waitFor = this.waitFor.bind(this);
|
|
95
|
+
this.emit = this.emit.bind(this);
|
|
96
|
+
this.emitFatal = this.emitFatal.bind(this);
|
|
97
|
+
}
|
|
109
98
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
EventBroker.prototype.on = function on(eventName, callback, eventOptions = {
|
|
100
|
+
once: false
|
|
101
|
+
}) {
|
|
102
|
+
const key = this._getEventRoutingKey(eventName);
|
|
103
|
+
|
|
104
|
+
if (eventOptions.once) return this.broker.subscribeOnce('event', key, eventCallback, eventOptions);
|
|
105
|
+
return this.broker.subscribeTmp('event', key, eventCallback, { ...eventOptions,
|
|
106
|
+
noAck: true
|
|
107
|
+
});
|
|
115
108
|
|
|
116
|
-
function
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
109
|
+
function eventCallback(routingKey, message, owner) {
|
|
110
|
+
if (eventName === 'error') return callback((0, _Errors.makeErrorFromMessage)(message));
|
|
111
|
+
callback(owner.getApi(message));
|
|
120
112
|
}
|
|
113
|
+
};
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}), broker.subscribeTmp('event', '*.error', errorCallback, {
|
|
128
|
-
noAck: true
|
|
129
|
-
})];
|
|
130
|
-
|
|
131
|
-
function eventCallback(routingKey, message, owner) {
|
|
132
|
-
if (onMessage && !onMessage(routingKey, message, owner)) return;
|
|
133
|
-
unsubscribe();
|
|
134
|
-
return resolve(owner.getApi(message));
|
|
135
|
-
}
|
|
115
|
+
EventBroker.prototype.once = function once(eventName, callback, eventOptions = {}) {
|
|
116
|
+
return this.on(eventName, callback, { ...eventOptions,
|
|
117
|
+
once: true
|
|
118
|
+
});
|
|
119
|
+
};
|
|
136
120
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
unsubscribe();
|
|
140
|
-
return reject((0, _Errors.makeErrorFromMessage)(message, owner));
|
|
141
|
-
}
|
|
121
|
+
EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
122
|
+
const key = this._getEventRoutingKey(eventName);
|
|
142
123
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
})
|
|
147
|
-
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
125
|
+
const consumers = [this.broker.subscribeTmp('event', key, eventCallback, {
|
|
126
|
+
noAck: true
|
|
127
|
+
}), this.broker.subscribeTmp('event', '*.error', errorCallback, {
|
|
128
|
+
noAck: true
|
|
129
|
+
})];
|
|
148
130
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
131
|
+
function eventCallback(routingKey, message, owner) {
|
|
132
|
+
if (onMessage && !onMessage(routingKey, message, owner)) return;
|
|
133
|
+
unsubscribe();
|
|
134
|
+
return resolve(owner.getApi(message));
|
|
153
135
|
}
|
|
154
|
-
}
|
|
155
136
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
return `activity.${eventName}`;
|
|
163
|
-
}
|
|
137
|
+
function errorCallback(routingKey, message, owner) {
|
|
138
|
+
if (!message.properties.mandatory) return;
|
|
139
|
+
unsubscribe();
|
|
140
|
+
return reject((0, _Errors.makeErrorFromMessage)(message, owner));
|
|
141
|
+
}
|
|
164
142
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
143
|
+
function unsubscribe() {
|
|
144
|
+
for (const consumer of consumers) {
|
|
145
|
+
consumer.cancel();
|
|
146
|
+
}
|
|
169
147
|
}
|
|
170
|
-
}
|
|
148
|
+
});
|
|
149
|
+
};
|
|
171
150
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
151
|
+
EventBroker.prototype.emit = function emit(eventName, content, props) {
|
|
152
|
+
this.broker.publish('event', `${this.eventPrefix}.${eventName}`, { ...content
|
|
153
|
+
}, {
|
|
154
|
+
type: eventName,
|
|
155
|
+
...props
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
EventBroker.prototype.emitFatal = function emitFatal(error, content) {
|
|
160
|
+
this.emit('error', { ...content,
|
|
161
|
+
error
|
|
162
|
+
}, {
|
|
163
|
+
mandatory: true
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
EventBroker.prototype._onBrokerReturnFn = function onBrokerReturnFn(message) {
|
|
168
|
+
if (message.properties.type === 'error') {
|
|
169
|
+
const err = (0, _Errors.makeErrorFromMessage)(message);
|
|
170
|
+
throw err;
|
|
178
171
|
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
EventBroker.prototype._getEventRoutingKey = function getEventRoutingKey(eventName) {
|
|
175
|
+
if (eventName.indexOf('.') > -1) return eventName;
|
|
179
176
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
switch (eventName) {
|
|
178
|
+
case 'wait':
|
|
179
|
+
{
|
|
180
|
+
return `activity.${eventName}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
default:
|
|
184
|
+
{
|
|
185
|
+
return `${this.eventPrefix}.${eventName}`;
|
|
186
|
+
}
|
|
186
187
|
}
|
|
187
|
-
}
|
|
188
|
+
};
|
|
@@ -28,11 +28,11 @@ function ExtensionsMapper(context) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function activate(message) {
|
|
31
|
-
|
|
31
|
+
for (const extension of activityExtensions) extension.activate(message);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function deactivate(message) {
|
|
35
|
-
|
|
35
|
+
for (const extension of activityExtensions) extension.deactivate(message);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|