AnsweredAssumed Answered

JTA and starting processes

Question asked by tdtappe on Mar 6, 2013
Latest reply on Mar 8, 2013 by frederikheremans1
I just started using Activiti. So my question(s) might be a bit "strange". Anyway…

I am using Activiti embedded in my app in a JTA context. When I for instance create a new order I start an order process via API.
The problem: the process starts right away without my order data having been committed yet. So in case the process initiates a service (REST) to do something
with the order it won't find the data. The same problem occurs when my order data is updated. In this case I "trigger" the process to see if it can proceed.
So I am looking for a way to kind of "defer" the start/triggering of the process to the point when the data has been committed - namely the end/commit of
the JTA transaction. Is there anything like this for Activiti?

Some workaround that comes to my mind is using suspension of processes combined with some Quartz scheduler. So in case of an order being updated I suspend
the process and the scheduler is looking for suspended processes every 5 seconds or so and activates them. This won't work for new processes though.
For this to work I need some additional dummy task right at the beginning of the/each process definition. Now the process can be started and will wait
at the dummy task. Then I can suspend the process and it will be activated by the scheduler and can proceed - able to read the committed data.

As you can see this very tedious and I don't like it at all.

So any help is highly appreciated.