10-18-2011 09:23 PM
10-19-2011 04:33 AM
10-19-2011 01:01 PM
Hi,
By default Activiti executes automatic tasks like a service task and a call activity in the same transaction.
That's also true when you use a multi instance construct. So even if you set sequential to false, the multi instance in your example will execute sequential.
There are 2 "solutions" to this. You can add a non-automatic task, like a receive task or a user task. This will cause the transaction to be committed and a new multi instance item will be processed.
Or you can use the asynchronous continuation functionality that's available in trunk and in a few days in 5.8 on one of the service tasks so that the transaction will be committed and a new multi instance item will be processed.
Best regards,
11-25-2011 09:16 AM
02-05-2013 06:01 PM
ArrayList<EachInputClass> myInputCollection = new ArrayList<EachInputClass>()
EachInputClass eachInput1 = new EachInput();
eachInput1.email = "jb@mymail.com";
eachInput1.username = "jimbarnes";
eachInput1.resultKeyVariable = "emailsendresult_jbatmymaildotcom_jimbarnes";
eachInput.callerExecutionId = execution.getId();
//next one
EachInputClass eachInput2 = new EachInput();
eachInput2.username = "raghuraman@mymail.com";
eachInput2.username = "ragu";
eacchInput2.resultKeyVariable = "emailsendresult_raghuramanatmymaildotcom_ragu";
execution.setVariable("myInputCollection",myInputCollection);
<extensionElements>
<activiti:in source="eachInput" target="eachInput"/>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="myInputCollection" activiti:elementVariable="eachInput"/>
Object myresult == ..//my results
String resultKeyVariable = (String) eachInput.resultKeyVariable;
String callerExecutionId = (String) eachInput.callerExecutionId;
runtimeService.setVariable(callerExecutionId, resultKeyVariable,myresult);
for(Object each: myInputCollection)
{
Object myresult = (Object) execution.getVariable(each.resultKeyVariable);
…
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.