2 Replies Latest reply on Jan 2, 2012 7:20 AM by gardellajp

    jBPM5 timers and persistence

    st_patriick

      The timers in the current implementation (jBPM 5.0.0) cannot outlive the knowledge session they were started in. Correct me if I'm wrong, but this is because the TimerService, that is used to schedule timer events, is bound to the knowledge session and is destroyed when the session is disposed.

       

      This makes the timers IMHO basically incompatible with process persistence.

       

      Trivial example is a process with a delay timer (from Esteban's JBPM-Samples):

      delayTimer.PNG

      1. Knowledge session is created.
      2. The process is started, waits on the timer and its state is persisted.
      3. The session is immediately disposed (before the timer event was triggered).

       

      In this case, the timer is never triggered and the process stays in the waiting state forever.

       

      A more practical example would be time-based escalations in long-lived processes. See Esteban's example:  http://community.jboss.org/message/595104#595104.

       

      Imagine a process where a task must be completed within a week, if not, an escalation is triggered. Naturally we would use process persistence in this scenario. The problem is that the knowledge sessions are short-lived (relatively to the process) and are disposed immediately after process instances are started. Certainly before the escalation timer would expire.

       

      Is there a way how to combine timers with persistence at this time? And if not, are there plans to support this scenario in some future release?