cancel
Showing results for 
Search instead for 
Did you mean: 

IntermediateCatchEvent under 5 secondes working only once

mathieum
Champ in-the-making
Champ in-the-making
Hello,

I am actually refactor my application which uses Activiti.

I am encoutering some issues with IntermediateCatchEvent.
In my workflow, I have an independant process which call a service every 2 second, so I use an intermediateCatchEvent inside :


<intermediateCatchEvent id="timerintermediatecatcheventUUID" name="TimerCatchEvent UUID">
      <timerEventDefinition>
        <timeDuration>PT2S</timeDuration>
      </timerEventDefinition>
</intermediateCatchEvent>

The event is fired fine the first time (after a delay of 2 second) but for the other calls, it seems the timer is not reset :


[17/02/2014 15:20:33.635][default-workqueue-3] Call service…[1]
[17/02/2014 15:20:35.097][default-workqueue-3] Call service…[2]
[17/02/2014 15:20:35.144][default-workqueue-3] Call service…[3]
[17/02/2014 15:20:35.176][default-workqueue-3] Call service…[4]
[17/02/2014 15:20:35.222][default-workqueue-3] Call service…[5]
[17/02/2014 15:20:35.269][default-workqueue-3] Call service…[6]

After a few try, I discover that the same code/process work fine with a timeDuration setted to PT5S (but not under).

Any ideas about this behavior ?

Thanks in advance,

Mathieu M
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Mathieu,

JobExecutor has set wait time to 5s. Try to decrease it. It can affect activiti performance. Does it really make sense to execute job each 2 sec?

Regards
Martin

smirzai
Champ on-the-rise
Champ on-the-rise
Hi Mathieu
You are right. The minimum wait time for job executor to peek the next job is 5 seconds. That is the maximum resolution with the default job executor.
If you need a finer grained resolution, you can extend the DefaultJobExecutor class, set its waitTimeInMillis property to whatever you want and inject it in process configuration.
I hope it helps you.

You should not set it too low as it will increase overheads.

mathieum
Champ in-the-making
Champ in-the-making
Hi Martin, Smirzai,

Thanks for the tip, it fixed my issue perfectly fine.

@Martin : In my application context, I must test the context every 2/3 seconds so I have no other choice.

Thanks again,
Regards,
Mathieu