3 Replies Latest reply on Jan 8, 2015 2:05 PM by Maciej Swiderski

    jbpm 6.1.0 : Problems with adding process definitions to JBPM RuntimeManager at runtime

    Chetan Math Newbie

      About the application:

      Simple apllication that uses jbpm 6.1.0 and we use PerRequest strategy. I am using jbpm api's to to manage the process state.

      Bpmn files are stored in the database

       

      Currently as recommended I am following the below.

      1. At application startup

      build RuntimeManager and keep it for entire life time of the application


      2. get RuntimeEngine from RuntimeManager,

         get KieSession and/or TaskService from RuntimeEngine

         perform operations on KieSession (start,complete)

         once done with processing dispose RuntimeEngine using RuntimeManager.disposeRuntimeEngine method

       

      3. At application shutdown

      close RuntimeManager

       

      Question:  New bpmn files can be added to the database and when this happens we want our application to be able to process/recognize this new bpmn/workflows

      without going for a restart.

       

      As per one of the recommended solutions , this is what we tried

      - Include logic to recreate runtime manager within the application with new resources added to it. But the problem with this solution is that, its a multi user application and hence the RuntimeEngine can be reffered from many places. We cannot just call runtimeManager.close() . Hence we tried to create an alternate RuntimeManager and then planned to swap it with the actual RuntimeManager when it was no longer referenced. But turns out we cannot have  two RuntimeManagers at the same time ( AbstractRuntimeManager - > throw new IllegalStateException("RuntimeManager with id " + identifier + " is already active");)

       

      Is there any simple/recommended way to do this? We are trying to add new process definitions without having to go for a restart.