5 Replies Latest reply on Oct 11, 2013 1:43 AM by Maciej Swiderski

    How we get all the running process instances with in a KnowledgeSession

    Shiju John Newbie

       

      Hi

       

      The result of the getProcessInstances() in the KnowledgeSession is getting as empty (size is 0).

      How we get all the process instances running with n a KnowledgeSession ? (JBPM 5.4)

        • 1. Re: How we get all the running process instances with in a KnowledgeSession
          mdegan Newbie

          Hi,

           

          Will need some more info to understand the reason:

          1) How are you creating the KnowledgeSession?

          2) Is there persistence enabled for session and processInstanceInfo? If yes, what is the sessionId, and is the sessionId same on all the processInstances available on its table?

          3) If your process does not have an external task, it will execute from start to end without stopping. This way, your query will never find a currently running instance. So do you have any external service task (Ex: human task) available on your process which would stop the processing from completing automatically?

          4) Have you tried creating a new instance and checking the "getProcessInstances()" after that? If you have a human task, the process will wait at that and you should see available instance.

          5) Please share (if possible) the process flow that you are trying and the code that you are using for the same.

           

          Regards,

          Manny

          • 2. Re: How we get all the running process instances with in a KnowledgeSession
            Shiju John Newbie

            Hi Mdegan

             

            start -> user task -> stop

            This is the sample representation of my process flow .

             

            yes my process instance is in running state.its  waiting for completing the user task.

             

            getProcessInstance(istanceId) it will return the Process instance details. But the the getProcessInstances() is not returning anything

            • 3. Re: How we get all the running process instances with in a KnowledgeSession
              Maciej Swiderski Master

              this is the intended behavior as all process instances when not currently executing are persisted in data base and not stored in ksession any more. They will be loaded when needed, for example when you use getprocessInstance(id) will the load given process instance from db. If you like to know what are the active processes use history log for this instead. What is important that in many cases it does not matter what session you use for moving on with the process. The only reason why you would care is when there is any state stored as part of the sessions such as timers or facts.

               

              HTH

              1 of 1 people found this helpful
              • 4. Re: How we get all the running process instances with in a KnowledgeSession
                Shiju John Newbie

                Hi Maciej,

                Thanks for the information.

                I am starting the JBPM with a fixed number of  session i want to know the load of each session.

                Thats why i required the total number of Process Instances running with in a session.

                On the basis of the load identify the session and process the request on that session.

                Is any way to get all the running process instances with in a session ?

                • 5. Re: How we get all the running process instances with in a KnowledgeSession
                  Maciej Swiderski Master

                  basically a session can process only single process instance at the same time others will wait in the queue so to say. If you like to know which session processed given process instance you could use process event listener to capture that information and store it somewhere that can be then queried for this info.

                  But I still don't really understand why would you need to know process instances per session? As mentioned above, every session can process any instance so having the tight coupling might be not needed.

                   

                  HTH