Who shoots first kills the other (Message Event)

Good morning friends!

I am modeling a process that does occur a situation in which two tasks in parallel. When one is finished , the other must die.

See attached model .

What implementations is the most recommended ?:
-java Class
-Expression
-Delegate Expression
-External
-Connector

I was acustumado easily develop it in another BPM , but Camunda , as I am beginner, I feel a little trouble .

If anyone can help me example , I am very grateful!

Hugs!

I would suggest you use a terminate end event[1] like this:

The first token to reach it will end the process

[1] Terminate Events | docs.camunda.org

Edit: as a side note - the model that you’re currently working on wouldn’t actually work because messages cannot be sent and received from the same process instance.

1 Like

Fulano Thanks for the help.

In fact my process does not end there, he has continued , but its solution can be used in conjunction with sub- process call, making very simple solution to implement.

Thanks, helped a lot !

Hi Rodrigo Carlstrom,

Below a new interested example shows how to interrupt a Task in a parallel flow within the same process instance by using a BPMN Signal Event

1 Like

Hi,

I’m a bit confused as to why this example needs to implement a custom ExecutionListener.
Is there a way to do this purely by BPMN modeling? It seems like the camunda-consulting diagram in github should just work, if the signal is sent, and caught as shown in the diagram. Is the need for the ExecutionListener because one parallel thread of flow doesn’t have access/ability to catch a signal thrown by the other pathway?

Thanks,
Galen

The issue is the scope of the Single event - which is all local and global scopes.
It will end up communicating with ALL instances waiting for to hear the signal, not just the one in the current instance.

Thanks! That clears up my confusion. Is there a way to do this without the listener? Could a “message” be used instead of a signal then, assuming there is only one message catch boundary event? I guess this might suffer from the same underlying issue…

Thanks,
Galen

nevermind, I just read that “messages cannot be sent and received from the same process” above.

2 Likes