Event based loops

Hello,

I am new to BPMN and I try to model an existing process of my company, which has an unusual behavior :
I have an activity at the begining, executed once, then, a subprocess that needs to be executed several times, but the amount of time is not predetermined in advance, and can happen at any time, triggered by an external application, or on demand by a human.

I think I could use loops on intermediate events to do so, but I’m not sure that my diagram is correct.
Here is my diagram :

I want the “Ignite project” activity to execute once, the “ignite sub-process” and “subprocess” activities to execute as many times as needed, and finally the “close project” activity to execute once all “sub-process” instances are finished and the “End Affaire” event is triggered (which is not the case in my diagram, it only waits for at least one instance to finish).

If the first part of the diagram is correct, how to detect that all “sub-process” instances are finished ?

Thanks in advance,
Nicolas.

Hi Nicolas,

This diagram would not achieve what you’re looking for - i think you might need to spend some time learning a about the basics of the modeling notation before you start trying to model something this complex.

Is the intention of this model for documentation or for eventual automation/execution?

I am learning basics since more than two weeks, but examples a always simpler than real processes.
The intention of this model is to learn BPMN on a real case. And redo it in the future when I will be more experienced (for documentation and communication purposes).
The only problem is that it is very complicated to check if a diagram is correct or not.

Sure sounds good - in that case if it’s helpful i can maybe discuss with you some of the potential errors with how your model?

By the way - what tool are you using to model bpmn?

Here are some quick comments:
The process will never end for the following reasons:

  • There is a live lock - every time a message comes in it will be re-activated.
  • Deadlocks can occur when both manual and automatic messages come in and the “end affair” message arrives afterwards.

It’s not clear what “Ignight project” does -is it done by a user is it done by a system? is it a task at all?

“Sub-process” is not the name of a task - this is very bad practice. firstly there is a a bpmn symbol for “sub process” that should be used and name of the element should be the name of the sub-process called.

What does close project do? is it a system call? user task?

Hi @nicolas_dubois_spie,

have a look at the non-interrupting event subprocess: https://docs.camunda.org/manual/7.11/reference/bpmn20/subprocesses/event-subprocess/

They may lead you to reach your goal.

Hope this helps, Ingo

Hello Niall,
Thank you for your help.

I’m using Camunda Modeler. I started with Bonita comunity but it doesn’t implements all the BPMN2.0 components.

For the livelock, you mean that the process continues to listen to events, even after it is supposed to be terminated (after “close project”) right ? So I need to put a “Terminate end event” in order to kill the event catchers, is that right ?
For the deadlock, if it occurs, won’t it be stuck on the parallel gateway, waiting for the “End Affaire” event ?

For information, this diagram is a simplified version of my real diagram, where I changed tasks names (for confidentiality) and types in order to run the token simulation extension and try some mechanics (but I think the extension doesn’t behaves like a real workflow).

“Ignight project” is a call Activity task, which is done by humans (meetings, signin process…)
“Sub-process” is a call Activity Task as well, and its name is explicit in my real diagram, it could be named “handle the document”, and it is the core of this process.
“Close project” is like “ignite project”, a call activity which contains user ans manual tasks like meetings.

Nicolas.

Thank you, I will try that.
It looks like it is perfect for my needs.

If you’re modeling for documentation initially, then maybe take a look at https://cawemo.com it’s also free to use but it’s cloud based and designed for collaboration and sharing. (not a requirement just something worth thinking about :slight_smile: )

Exactly! :slight_smile:

Well the issue that there are potentially 3 tokens that can arrive at the gateway - after the first two arrive it’ll continue but then after the 3rd one shows up - it will deadlock while waiting for another.

Yes, I think it could help in the future, but are the diagrams stored securely ? Because it is confidential.

Okay, perfect.

Oh ok, I see, that happened with the token simulation plugin. I tought it would wait for sequence flows to all have at least 1 token, and not only the right amount of token on any sequence flow.
This is not the behavior I was looking for anyway, I need it to do the “Close project” when all “sub process” activities are ended and the “End Affaire” event is caught.
I will try to find a solution that could work with event based subprocess.

Thank you for your help.
Nicolas.

I think I got it right, Here is the new version of the diagram :


I think there is no more dead lock, since there is no more parallel gateway.
I guess it should wait for all started instances of the event subprocesses to end, and the “End Project” event to be caught before closing the project.
I wonder if I could use a single event subprocess with two message start events, since both calls the same subprocess.

Thank you for your help,
Nicolas.

1 Like

Hi @nicolas_dubois_spie,

this process model looks good.

Two different startevents are not allowed in an event subprocess. There is no further simplification available.

Hope this helps, Ingo

Okay, Thank you very much for your help.
Nicolas.