1 Reply Latest reply on Oct 30, 2012 12:59 PM by swiderski.maciej

    Persisted process not resuming from wait state

    jasonjho

      Environment: jBPM 5.2.0 + Drools 5.3.1 + H2

       

      I have a jBPM flow that is configured for persistence and after a server restart, is reloaded the following way:

       

      {code:java}

      ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(session_id, kbase, null, env);

      ksession.addEventListener(listener); // this doesn't seem to work

      ksession.fireAllRules();

      {code}

       

      At this point, shouldn't the workflow process be restarted?  I can see that there are processinstanceinfo, sessioninfo and eventtype tables in my database, so I know some information was persisted from my original execution.  But why is the event listener not being called after the reload to let me know what node the workflow is currently on, and subsequently, what node the process is traveling to?

       

      In my workflow, let's say I am halfway through and I come across a wait states that looks like the following:

       

      {code}

      <intermediateCatchEvent id="_6" name="Wait for Document Approval" >

            <conditionalEventDefinition>

                  MyDocument(status == "Approved")

            </...>

      </...>

      {code}

       

      At this point, a rule is evaluated and changes the state on MyDocument to "Approved", causing this wait state to unblock and move to the next node in the workflow.

       

      I thought at this point, jBPM would persist the process b/c it is considered a "safe point".  But when my server is restarted and I try to advance the workflow from this wait point (let's say I change the document status to "Approved") - it never moves forward.  Part of me thinks that the worklow is not really running  -- only the rules alone that are being fired in the session.

       

      So my question is - how can I verify that this workflow is correctly restarted and resumed?  I thought the EventListener on the session would be notified of node entry/exit as it does normally.

       

      Any ideas?