cancel
Showing results for 
Search instead for 
Did you mean: 

Timer firing every 5 minutes after proper execution

darkredd1
Champ in-the-making
Champ in-the-making
Hi all,

I am working on a project that requires timers for reminders and escalation. I have so far managed to deliver on that, with the following concern however; (I will display the code later) I set a timer to fire 24 Hours (Reminder) later after the start of a task, and it successfully does. However, after every 5 minutes from the successful execution, it keeps firing (sending mails) therefore flooding the respective inbox with reminder mails. All I want it to do is fire only once, here are the code snippets:

1.

  var dayHours = dac_daysBeforeReminder * 24;
  var tempDays = "R1/PT" + dayHours + "H";
  execution.setVariable('reminderdays', tempDays);

The above code is in a usertask "assignment" tasklistener. Note how I explicitly mention to execute only once ("R1/PT24H")[/]

Below is the timer definition:
2.

<boundaryEvent id="reminder" cancelActivity="false" attachedToRef="recommendationTask">
       <timerEventDefinition>
          <timeCycle>${reminderdays}</timeCycle>
       </timerEventDefinition>
    </boundaryEvent>

In the another instance I used the timeDate constraint but it didn't recognize my cron expression which was structured like e.g.
"2013-08-21T12:00:00"
using a string as the passing variable instead of a date object.

What I would like help with is how to have the timer fire only once after the specified time period.

My dev environment is as follows: Alfresco Enterprise 4.0.2 embedded with Activiti engine 5.7

Regards
DarkRedd
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

Using a cycle with R1 wouldn't make much sense, then a timeDate would be a more valid option.
The timeDate content or variable should be defined as a ISO8601 String.
Which error message did you receive for that?

Best regards,

darkredd1
Champ in-the-making
Champ in-the-making
Hi,

When I attempted with timeDate, I used the ISO8601 as advised by the activiti user guide. I get the following error with my attempts:

Cause: org.activiti.engine.ActivitiException: coudn't deserialize value 'sun.org.mozilla.javascript.internal.NativeDate@d99967' in variable 'reminderdays'
This is how I had it formatted:
<code>
var now = new Date();
now.setDate(now.getDate()+1);
reminderdays = now.getFullYear() + "-" + now.getMonth() + "-" + now.getDate() + "T" + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
</code>
And what I get as print out from the above is "2013-07-27T9:1:13"

As you can see I use the ISO standard formating, unless if I am missing something.

Regards
DarkRedd