cancel
Showing results for 
Search instead for 
Did you mean: 

How to do spring transactions in a BPMN way

tanzy831
Champ in-the-making
Champ in-the-making
Hi Everyone,

I am building a application with have modular logics inside, e.g. logic A, B, C, D. A typical user will summit his/her desired way of how to use these logics, telling the application whether he/she wants A->B->C->D or D->B->A->C by drawing and organizing these serviceTasks in the activiti explorer.

Now here comes the problem:

I want to add in a feature to allow users to "define" the boudary of transactions. We do not want the whole process of  A->B->C->D to roll back and start over if it fails halfway. What we want is to be able to tell the Activiti Engine that there is a boundary between B and C so that if C or D fails, task B will not be repeated, and the process will just starts over from C instead of A.

Now, I have read the user guide of Activiti and found that I can put a @Transactional tag when using Spring integration. All the thing you do inside that tag can be rolled back if it fails. Now, I am not sure how to implement the feature I mentioned above, so I wonder if anybody can help. I also worries that @Transactional is more of a hard-coded way to do this, and it will not be easy to let the user determine boundaries flexibly. I wonder whether there is some better way to do this, like, for example, to put a <transaction></transaction> tag inside the .bpmn file to set the boundary?

Please help ASAP, thanks!
2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

the case you have described can be covered by async flag
http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions

Regards
Martin

tanzy831
Champ in-the-making
Champ in-the-making
Hi Martin,

Thank you for answering! I thought my post was deleted as I could not found it days ago. Now I finally see this.

I have tried out the async flag and I know it will work, but actually, in my situation I cannot allow the system to do open another thread. I need it to be sync. In that case, what should I do then? Is it still doable?

If it is not doable, I would also like to modify the code a little bit, any suggestions. But I am not sure how can I do that. I cannot even build the source code successfully. The maven file seems to have unresolved symbols (in version 5.21 and 5.19) and there are so many profiles and I do not know which one to choose. Any instructions?

Regards,

Michael