01-15-2018 05:08 PM
Hi All,
I have activiti workflow in place which has "intermediateCatchEvent" as below.
<intermediateCatchEvent id="assetUploadTimer" name="Asset Upload Timer">
<timerEventDefinition>
<timeCycle>R/PT1M</timeCycle>
</timerEventDefinition>
</intermediateCatchEvent>
As you can see in my <timerEventDefinition> I have set time as 1 min. Every minute this timer task will call a ServiceTask to check file/asset upload progress. What I would like to do is set <timeCycle> value dynamically.
I am starting my activiti process using below code.
this.runtimeService.startProcessInstanceByKey(UploadAssetController.ASSET_UPLOAD_PROCESS,
variables)
Map variables contains size variable. So, if size is > 1GB then I want to set <timeCycle> as R/PT30M (every 30 min), and if it's < 1GB then set <timeCycle> as R/PT1M.
I thought to add this condition in <sequenceFlow> and check size variable, if it's > 1GB then go to <intermediateCatchEveny id="checkEvery30Min">, else go to <intermediateCatchEveny id="checkEvery1Min">.
I would like to know if I can avoid adding two <intermediateCatchEveny> and update existing <intermediateCatchEvent id="assetUploadTimer" name="Asset Upload Timer"> to assign different <timeCycle>.
Let me know your suggestion.
Regards.
01-21-2018 03:12 AM
You can set timeCycle dynamically by using el expression like the following expression.
${execution.getVariable('size') > 1 ? 'R/PT30M' : 'R/PT1M' }
<intermediateCatchEvent id="sid-45AAE2AF-7FF9-4CDB-B278-DEABEC988D0B">
<timerEventDefinition>
<timeCycle>${execution.getVariable('size') > 1000 ? 'R/PT30M' : 'R/PT1M' }</timeCycle>
</timerEventDefinition>
</intermediateCatchEvent>
Explore our Alfresco products with the links below. Use labels to filter content by product module.