3 Replies Latest reply on Aug 8, 2011 1:15 PM by swiderski.maciej

    How to make console reload process instances after a recycle

    jjfutt

      Hello All:

       

      I am trying to understand how to make the console show instances that are were in process when the server was restarted, as well as how to load instances (for visibility purposes) that might have been initiated by different java processes with different sessions. To further explain my questions, let me describe what I have done so far.

       

      (1) Installed the JBPM 5 demo

      (2) Used the instructions provided by Kris Verlaenen in a different thread (http://community.jboss.org/message/577830) to configure the demo with a different database. In my case, I configured it with an Oracle database.

      (3) Re ran the "ant install.demo" task to make the database chagne effective. (Note: I also changed hibernate hibernate.hbm2ddl.auto policy to validate to avoid recreating the tables again and again).

      (4) Ran the demo.

       

      At this point, everything works well. I can start process instances of the "Evaluation" process from the demo using the console. I see the tasks for user kris, john, and mary. And I see the rows getting created and updated in the database tables as expected. However what I also see is that:

       

      Observation: If I recycle the server, all database info is wiped out. I set the hibernate.hbm2ddl.auto to validate to avoid this. However, now when I recycle the server, the data from previous instances of the running processes (that were waiting on the completion of the human task) and the session is still there after the restart. However, the Console DOES NOT show these instances. Also, the pending human tasks do not show up in the 'Tasks' section within the console.

       

      Question 1: How can I force the console the reload the instances (And hence allow us to check the status ) of process instances that are still active but were initiated before the server recycle?

       

      Question 2: When the console is started, in which condition it creates a 'new' session in the database and in which condition does it load the previous session. Before I changed the hibernate.hbm2ddl.auto policy to validate, the entire set of tables were being recreated upon recycle. Now that hibernate.hbm2ddl.auto is set to validate, each time I start the server, the console apparantely uses the same session id that it created the very first time. However, it doesn't automatically load the previous process instances that were created using that session.

       

      Question 3: If we initiate process instations from other java components running as independent applications outside of the console, they may have different session ids. Is the console supposed to show all active process instances across all sessions, or does it only show process instances from its own session? Is it possible to make the console show instances from a specific session?

       

      Question 4: the "Evaluation" process part of the demo, does not get reloaded into the console when I restart the server. Also the pending human tasks (for john and mary for example) don't show up in the tasks section either. How can I force the console to reload and resume the processes after the recycle?

       

      Thank you all in advance.

        • 1. Re: How to make console reload process instances after a recycle
          calca

          Hi man,

           

          I don't know it this can be the problem, but inside the console server you can find hibernate.cfg.xml inside WEB-INF/lib/jbpm-bam-<<version>>.jar//hibernate.cfg.xml

           

          This has by default "create" and may be interfering with the configuration you have in persistence.xml.

           

          I think this will be fixed after 5.1.Final, as it was here:

          https://github.com/droolsjbpm/jbpm/blob/5.1.x/jbpm-bam/src/main/resources/hibernate.cfg.xml

           

          And now it is not in master anymore:

          https://github.com/droolsjbpm/jbpm/tree/master/jbpm-bam/src/main/resources

           

          The console uses audit tables (ProcessInstanceLog, VariableInstanceLog, NodeInstanceLog) to show the information, and not runtime tables. So if these tables are re-created, you will se running processes but no data in audit tables.

           

          About the human tasks, check the persistence.xml inside WEB-INF-lib/jbpm-human-tasks-<<version>>.jar//META-INF to see if it is in create.

           

          Regards,

           

          Demian

          • 2. Re: How to make console reload process instances after a recycle
            jjfutt

            Thank you Demian, your pointers gave me additional things to look into and change.

             

            All: I believe I am closer than before, but still need help resuming the "Human Task Services" after a restart. Here's what I have done:

             

            1. For the 'Evaluation' flow in the JBPM5.1 DEMO setup
            2. In the directory:  jbpm-installer/db/, I updated the hibernate-cfg.xml, persistence.xml and testDS1.xml to make everything point to my Oracle DB. Also updated the hibernate.hbm2ddl.auto property to 'update' instead of 'create'
            3. Ran ant install.demo
            4. Ran the demo, everything runs fine. When I recycle the server, and go back to console, I see previous instances of 'evaluation' that do show up in appropriate status
            5. I recycle the server while my 'evaluation' instance is pending on completion of human activities. Once I recycle the server, I correctly see that those processes are pending on completiong of human task services, HOWEVER, when I login as john, mary, or krisv, I no longer see the human tasks in the task view as I was able to before the recycle. I expect to be able to see them becuase I haven't completed the tasks yet and was expecting the console to present them again after the recycle.

             

            So now my question comes down to this: How to make the human tasks show up in the task section of console again after a recycle? And do the processes require any manual intervention to make them 'active' after a recycle?

             

            Thanks    

            • 3. Re: How to make console reload process instances after a recycle
              swiderski.maciej

              How do you start Task Service?

              I can say only what Demian already mentioned, jbpm-human-task*.jar contains persistence xml that has "hibernate.hbm2ddl.auto" property set to create. That is the default one. Did you modify that persistence configuration of task service to point out to your Oracle db too?

               

              Since jBPM and Task Service are two separate instances they do not share the same persistence configuration. As it goes for console, it uses TaskClient to connect to TaskService so in fact they are independent.