5 Replies Latest reply on Mar 6, 2017 3:44 PM by itz.somnath

    PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM

    rahul7163

      Hello All,

       

      I come across the situation where i have started the process instance using the Singleton Session Strategy and taken the RuntimeEngine object like below:

      RuntimeEngine engine = runtimeManager.getRuntimeManager(EmptyContext.get())

       

      After this i moved from SingletonSessionStrategy to PerProcessInstance session strategy. Now, when i am trying to get the RuntimeManager instance using below statement:

      RuntimeEngine engine = runtimeManager.getRuntimeManager(ProcessInstanceIdContext .get(500))      // here 500 is my processInstanceId

       

      I am getting below exception:

       

      org.kie.internal.runtime.manager.SessionNotFoundException: No session found for context 500

       

      Can't i use the process created using Singleton session strategy with Per process instance strategy? Can someone tell me if it is possible?

       

      Regards,

      Amit

        • 1. Re: PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM
          swiderski.maciej

          you can't change strategy for already running process instances as they won't have context established thus the error message you see. Per process instance means that on process creation ksession will be saved and managed with the process instance. Since you use singleton there is no such info.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM
            rahul7163

            Hi Maciej,

             

            Thank you for the reply. Is there any way we can identify whether the request is raised using Singleton or Per Process Strategy? If that is case, then we can at least handle the request accordingly.

             

            regards,

            Rahul

            • 3. Re: PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM
              swiderski.maciej

              not sure what you try to achieve but that would mean you should have two runtime manager instances in place and then use their identifiers to distinguish. For example when you initially used singleton and then switched to per process instance that would mean you should still have both available until all process instances from singleton are completed. At the same time you should avoid creating new instances from the singleton one and always direct them to the per process instance.

               

              HTH

              • 4. Re: PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM
                rahul7163

                Hi Maciej,

                 

                I just want to now how we can identify the process that are raised using singleton session strategy so that i can handle it accordingly. It seems that the approach you suggested will work without any problem. Thank you for the solution.

                • 5. Re: PerProcessInstanceStrategy and SingletonSessionStrategy in jBPM
                  itz.somnath

                  I'm experiencing same kind of scenario.

                   

                  I have two runtime strategies deployed, singleton (old processes: version 1) and per process instance (new processes: version 2). I'm trying to migrate processes from version 1 (singleton) to version 2 (per process instance). While migrating, it updates the process version to 2 but it shows the following error while browsing the task,

                   

                  error: "Unexpected error occurred: org.kie.internal.runtime.manager.SessionNotFoundException:No session found for context 69970"

                   

                  How can I handle this scenario?

                  quick question: do process migration in bpm6 works across runtime strategies? or under same strategy only?