3 Replies Latest reply: Apr 24, 2012 5:28 AM by remohamed RSS

listing active processes in a persisted and resumed ksession

Jason Wu Newbie

Hello,

  I'm trying to test out persistence with jbpm and so I have a StatefulKnowledgeSession that I have enabled persistence for.  I run a few processes that have userTasks and are waiting for the user to complete and then I gracefully shutdown the setup.  I bring it back up and load the previous sessionid to get a new StatefulKnowledgeSession.  I now want to see all running processes, mainly the processes that are currently waiting on a userTask but were started in the previous run.  How can I get this information from the ksession?

  • 1. Re: listing active processes in a persisted and resumed ksession
    remohamed Newbie

    please i have the same problem , i need to list all the process instances after shutdown and restart the server and load the KSession . any one have a clue ?

  • 2. Re: listing active processes in a persisted and resumed ksession
    Arun V G Newbie

    Active process instances can be retrieved by using the API

     

    knowledgeSession.getProcessInstances()

  • 3. Re: listing active processes in a persisted and resumed ksession
    remohamed Newbie

    Dear Arun ,

    i already did this but it doesnt work for the instances that was instantiated befor server down . in other word although there are active instances was started befor the server was down and presisted in DB , when i call knowledgeSession.getProcessInstances() it returns null , it only works if i start a new instance and then try to retrive it using this call but without restaring the server .. am i missing something here .. i did load the seesion after restart and didnt creat  new one , is there any thing else i need to do .. 

     

     

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

     

    ksession.getWorkItemManager().registerWorkItemHandler("Human Task",new CommandBasedWSHumanTaskHandler(ksession
    ));

     

    ksession.getProcessInstances() >>> null pointer Exception