cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti engin thread model question

tonyado
Champ in-the-making
Champ in-the-making
FYI. I am a newbie to activiti, and am learning how I can use activiti. For some use cases, I want to be able to block my process execution, wait for some messages(or signals), after see activiti doc carefully, I decide to use java receive task. But here comes a problem, I cannot find the detailed explanation about how receive task works, so I am worrying if I send a message before engine execute to the receive task node, will the receive task still get this message, if not my process will block on this receive task forever. Hope someone knows can help me.
4 REPLIES 4

tonyado
Champ in-the-making
Champ in-the-making
Also I have the same worry about event. I want to know how event works in activiti.

warper
Star Contributor
Star Contributor
I believe user guide explains it clearly.
To continue process from receive task or signal catching event, you should send signal from external java code.
Process should be persisted in database in order to receive signal and for common case it should not actively do something at that time. That is, if your process did not reach receive task and you send signal, nothing good will happen.
Your code should query activiti engine for processes waiting in proper state and send signal that time. For short processes it can just wait and repeat. For long processes you have to make more sophisticated work-around.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Tony,

if I send a message before engine execute to the receive task node, will the receive task still get this message
No, in that case signal is not delivered. If you need such a functionality use some kind of messaging system with queues.

To get familiar wit messages/signals/receive tasks read documentation and have a look on the activiti jUnit tests - the best documentation is code. 🙂

Regards
Martin

tonyado
Champ in-the-making
Champ in-the-making
Thanks Warper and Martin very much, I just understand how it works.