AnsweredAssumed Answered

flushing activiti data to the database

Question asked by joachimvda on Oct 22, 2013
Latest reply on Oct 31, 2013 by trademak
Is there a way to force activiti to write the internal state to the database? I would like something similar to flushing the session in Hibernate?

The problem I am facing is that I have two flows (say flow A and B). A listener on a task in flow A wants to transition flow B by one or two steps. Say flow B has tasks K-L-M-N. The listener on flow A want to transition Flow B to task N if either L or M are the current task.
I do this by doing the fllowing consecutively:
1. search tasks on flow B, if taskDefinitionKey matches L -> transition the task
2. search tasks on flow B, if taskDefinitionKey matches M -> transition the task

This works fine if flow B is on task K or N, keeping it there.
This works fine if flow B is on task M. In that case 1. does nothing and the flow ends up on task N
This fails when flow B is on task L. In that case task L is transitions on 1. moving the flow to task M. However when determining the current task in step 2., it still return that L is the current task.

Is there a way to force the code to "know" that flow B has already transitioned in 2?

I read that async may be a solution to this, but I need everything to execute in one transaction. There are a lot of validations happening in both flows, and success should be all or nothing.

Thanks for your help.

Kind regards,
Joachim

Outcomes