7 Replies Latest reply on Dec 4, 2013 3:10 AM by Maciej Swiderski

    JBPM6 - RuntimeManager @PerProcessInstance and KSession

    Fer Gia Newbie

      Hi!

      I have an RuntimeManager annotated with @PerProcessInstance in CDI:

       

      @Inject
      @PerProcessInstance
      private RuntimeManager manager;
      
      
      @Inject
      private TaskService taskService;
      

       

      I create a new process like this:

       

      RuntimeEngine engine= manager.getRuntimeEngine(ProcessInstanceIdContext.get());
      KieSession session=engine.getKieSession();
      session.setGlobal("foo", new Foo());
      session.startProcess("jbom.myProcess",paramMap);
      
      

       

      Thats works OK.

      When the process is created, inside the first task the global "foo" is correct and working.

      But when I try to acces the "foo" global in a separate request (for example when the task is completed)  this is null.

       

      If I use a @Singleton RuntimeManager the global is alive at all the tasks, but with PerProcessInstance its resets to null

       

      Is any way to keep the global alive during the process lifecycle?

       

      Thanks!