Dynamically set value of <timeCycle>

Showing results for 
Search instead for 
Did you mean: 
Member II

Dynamically set value of <timeCycle>

Hi All,

I have activiti workflow in place which has "intermediateCatchEvent" as below.

<intermediateCatchEvent id="assetUploadTimer" name="Asset Upload Timer">

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.


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.


1 Reply
Senior Member

Re: Dynamically set value of <timeCycle>

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">
  <timeCycle>${execution.getVariable('size') &gt; 1000 ? 'R/PT30M' : 'R/PT1M' }</timeCycle>