paed01 / bpmn-engine

BPMN 2.0 execution engine. Open source javascript workflow engine.
MIT License
860 stars 166 forks source link

How to STOP the engine? #140

Closed Kirikkayis closed 2 years ago

Kirikkayis commented 2 years ago

Hey,

i have the following Code:


const engine = Engine({
  name: 'execution example',
  source: processModel
});

listener.on('activity.start', (start) => {
       console.log(start.id);
       if(start.id === "Activity_XYZ") {
              engine.stop();
       }
}

I want to stop the engine in my listener for 'activity.start' if the start.id equals 'Activity_XYZ'. The code above 'engine.stop()' doesn't stop the engine and all the following Activities after 'Activity_XYZ' are executed.