AnsweredAssumed Answered

Dynamically set value of <timeCycle>

Question asked by alfsender on Jan 15, 2018
Latest reply on Jan 21, 2018 by daisuke-yoshimoto

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.

Outcomes