How to do spring transactions in a BPMN way

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2016 10:43 PM
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!
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!
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 04:34 AM
Hi,
the case you have described can be covered by async flag
http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions
Regards
Martin
the case you have described can be covered by async flag
http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions
Regards
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2016 09:04 AM
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
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
