cancel
Showing results for 
Search instead for 
Did you mean: 

About DB persistence after each step for BPM flow with only 'Service tasks'

kssaokar
Champ in-the-making
Champ in-the-making
We have the following use case that we are trying to implement using Activiti -

These 3 steps are constitute a BPM flow -
1. Service Task 1 - some data capture task say from a queue
2. Service Task 2 - Some data transformation task
3. Service task 3 - persisting data results calculated in step 2

Now we need to make sure at each step BPM data is persisted so we know how long it took for each step.

Also say if Step 2 fails we need to make sure Step 1 execution details are persisted in activiti tables.

We also understand that in Activiti for Service tasks data is persisted only on success of all steps. We would like to know how to model above scenario in Activiti so it meets our needs using Activiti i.e. ensure data is persisted upon failure of a step.

Lot of questions in the forum similar to above question mentions use of wait state, receive task,etc…but we are looking for best practice to achieve above.

Any suggestions please?
8 REPLIES 8

jbarrez
Star Contributor
Star Contributor
Make your service tasks async, and you'll get all the features you wanted.

kssaokar
Champ in-the-making
Champ in-the-making
What if we want to pass results of Service Task 1(thru process variables) to Service Task 2 and from there to Service Task3?
Will this work if I just set flag to async?

pavitra
Champ in-the-making
Champ in-the-making
Hi,
I tried this sample even I have similar requirement with little modification in it.
I want to log each step but when exception occurs it has to stop and persists previous tasks in activiti table.By making async ture,
it persists all the steps in the workflow to activiti tables even when the exception occurs.
My sample is like this:
Start–>Step1(Service task)–>Step2(Service task)–>Step3(Service task)–>end.
When Exception occurs in Step2(Service task) I want to persist the Step1(Service task),Step2(Service task) with Exception and it should not continue to Step3(Service task) to persists in the actviti tables.
I want to persists the previous and current(Exception rises) steps to log into the activiti tables and it should stop logging  next steps i.e the steps after the exception.
I tried with "Boundary Error Event" also, but same thing continued. How can I achieve this ?
Thanks in advance.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I would use boundary error event (Thrown exception must extend BpmnError class).

Regards
Martin

pavitra
Champ in-the-making
Champ in-the-making
Hi,
Thanks for the suggestion.It worked for me , I have few questions to know about. When my step throws Bpm Error which is attached to boundary error event, its ID is stored in 'act_ru_execution ' table but I have got two entries in it.So why its 2 entries ?Thanks in advance.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Pavitra,

Could you create jUnit test for this case?
https://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin

pavitra
Champ in-the-making
Champ in-the-making
Hi,

I am running 2 different Activiti process, all of them use service tasks in async mode.In this case if I am running one workflow in one process(in async mode) - will this affect the other process? -  what I see when running the sample attached below is activiti in multiple processes. HelloWorldWorkflow1ProcessMain is executing the workflow steps in the HelloWorldWorkflow2ProcessMain. Both have different workflow running in different process.

I want first process to take care of workflow steps running in first process(HelloWorldWorkflow1ProcessMain)and the second process to take care the workflow steps in the second process(HelloWorldWorkflow2Process ).

see for example - HelloWorld1Flow - has 3 steps and running in HelloWorldWorkflow1ProcessMain, and
HelloWorld2Flow - has 3 steps and running in HelloWorldWorkflow2ProcessMain. We don’t want HelloWorldWorkflow2ProcessMain to run the workflow steps(HelloWorld1Flow) in the HelloWorldWorkflow1ProcessMain and vice-versa. Both processes are running in parallel how do we achieve this? Thanks in advance.

See I have attached my actviti.config.xml file and two workflow file more information.For two different process I use the same activiti configuration(actviti.config.xml).



pavitra
Champ in-the-making
Champ in-the-making
I opened new topic on the above issue.Please Ignore it.