4 Replies Latest reply on May 12, 2008 10:50 AM by dleerob

    Dynamic timers ?



      Has anybody ever tried to use dynamic timers in jbpm ? I am aware of the timers that can be configured statically but rather then that I would like them to be dynamic on for instance registrations in an external db etc.

      Any ideas or help etc greatly appreciated,


        • 1. Re: Dynamic timers ?

          Dynamic timer can be implemented by using a custom ActionHandler,
          defined in an action that is set on the timer-create event.

          The custom ActionHandler can then retrieve the Timer from the database, and change its values.

          • 2. Re: Dynamic timers ?

            Is there a "timer-create" event? I cannot seem to find the option in the GPD. I would like to give each timer that is created for each instance of a task, a different name.
            Eg. statically, the timer is given a name with the following declaration:

            <timer duedate="0 seconds" name="Document Review Reminder" repeat="24 hours">
             <action class="workflow.jbpm.TaskReminder"></action>

            I would like to then dynamically change the name of each timer, for example: "Document Review Reminder 1" and "Document Review Reminder 2" etc. This is to workaround a jbpm bug (http://jira.jboss.org/jira/browse/JBPM-1170).

            Anyone got any ideas?

            • 3. Re: Dynamic timers ?

              Hmmm...I tested changing the name of the timer in the action class that the timer calles, by calling executionContext.gettimer().setName("NewName");

              It updates the name of the timer, but now when the task instance ends, the timer is not removed. Im guessing the original name as defined in the static xml file is used to remove/end timers. That's doesn't help.

              Looks like I may need to dynamically create the timer in the first place.

              • 4. Re: Dynamic timers ?

                It seems if I dynamically create the timer, they are not ended/removed when the task instance ends.