1 Reply Latest reply on Aug 30, 2013 12:14 PM by swiderski.maciej

    How to query on deployed process definitions?

    fellowtom

      Hi all,

       

      I have jbpm running embedded in my application. So when the app is started by a user who logged in correctly, then I want to show all deployed processes.

      Everytime the app is started I setup the engine(connect to db). But with simple setup of (which is probalby the problem):

      runtimeEnvironment = RuntimeEnvironmentBuilder.getDefault().get();
      runtimeManager =     RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(runtimeEnvironment);        
      runtimeEngine =      runtimeManager.getRuntimeEngine(EmptyContext.get());
      KieSession ksession = runtimeEngine.getKieSession();
      
      

      Then the app shall be able to delete or add deployments at runtime. ATM it works to deploy additional proceses via :

      runtimeEnvironmentBuilder.addAsset(ResourceFactory.newClassPathResource(classPathResource[i]), ResourceType.BPMN2);
      runtimeEnvironment = runtimeEnvironmentBuilder.get(); //...
      
      

       

      Now my problem is, that i dont know how to query on the already deployed processes. I dont want the engine to deploy them all the time on startup. I havn't found such data in db, like "deployedProcessDefinitions" which I could query on startup and then load them to environment. Or isn't this data stored in any db?

      Which is the corrent way of handling this issue? I'm glad for your hints.

       

      With kind regards,

      Thomas

        • 1. Re: How to query on deployed process definitions?
          swiderski.maciej

          process definitions are not stored in data base especially that you don't need to have data base to run processes. These are runtime resources so that means it's up to your application to deploy what assets you need when you start an application. Once it's started you can get available process instance from the build environment

          RuntimeEnvironment.getKieBase().getProcesses().
          

           

          You can do the same from already active RuntimeManager but you need to cast it additionally to get environment from it:

           

          ((InternalRuntimeManager)runtimeManager).getEnvironment().getKieBase().getProcesses()
          

           

          HTH