paed01 / bpmn-engine

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

Event sub process errors on second event #180

Closed waeljammal closed 2 weeks ago

waeljammal commented 10 months ago

Hi,

Firing 2 events to trigger an event sub process causes the second event to trigger an activity is already running error. I expected the second event to spawn a new process instead but instead it tries to run() the same start activity a second time. Is a sub process that is triggered by an event only expected to run once?4

My use case is that I have some sub processes that have a error boundary event on them and the error boundary event is linked to a error end event, then I have a event sub process that has a error start event and when more than 1 of the other sub processes throw an error it causes this issue to happen.

Screenshot 2023-08-12 at 7 55 50 pm

waeljammal commented 10 months ago

It seems event sub process does not work even with signals, I tried this and nothing happens.

Screenshot 2023-08-12 at 11 13 03 pm

paed01 commented 1 month ago

Sorry for the late answer.

You are correct about the second signal event scenario. It's not triggering. I'm investigating that.

The first scenarion works if global errors are used. Then sub-process runs twice. Anonymous errors not so much. Investigating that as well.

paed01 commented 1 month ago

Ok, lets see if I can explain my findings?

The issue is that there is a difference on how signal-, error-, and message-events are handled. Errors and messages are delegated within the process, signals are not. My understanding is that signals are global, meaning that they intend to be triggered outside the process. But if signals are global they should also be able to trigger within the same process. Makes no sense otherwise. I will see if I can make this happen without breaking something else.

paed01 commented 1 month ago

So this works with signals:

signals

paed01 commented 1 month ago

@waeljammal can you make another attempt firing events?