1 Reply Latest reply on Jul 5, 2016 11:39 AM by Abhijit Humbe

    How to get the deploymentId of a Process definition

    Tamás Járvás Newbie

      Hi,

       

      I started to implement a web application with jBPM 6.3.0.Final integration, which will be running in JBoss. I already have a running instance of jbpm-console in another JBoss. My current setup is:

      - processes can be designed in the jbpm-console webapp. In the jbpm-console, if a project is deployed, it is also deployed to our own Nexus repository.

      - as a result, I just have to add my deployed project as a dependency in my webapp's POM (with the current version) and I can access it, because my jBPM runtime uses the newClasspathKmoduleDefaultBuilder() and it founds my kmodule kjar in my classpath

      - I am not using the REST API, except for one feature: I would like to show the SVG image of the process instances in my webapp on a task form. For this, I am configured everything, so I am able to access the generated SVG files at the url: {jbpm-console-url}/rest/runtime/{deploymentId}/process/{processDefinitionId}/image/{processInstanceId}

       

      This last thing works great, if I hardcoded the url. I am able to get the Process.getId() for the processDefinitionId. Also I have the Task.getTaskData().getProcessInstanceId() for the processInstanceId variable on the Task form. But I wasn't able to get the deploymentId, which is a Maven GAV. Of course I don't want to hard-code it, because later there could be multiple deployments and also in case of a version change, I only want to change my web app POM, not the code.

       

      So in short, I would like to get the deploymentId (GAV) from a Process.

       

      I tried to list the available deployments found in the classpath, but I didn't found any way to do it. The only thing I found is the KieServices.Factory.get().getRepository() where I can see in debug mode the stored KieModules, but there is no interface to get them.

       

      Thanks

        • 1. Re: How to get the deploymentId of a Process definition
          Abhijit Humbe Master

          You can use following REST API to findout deploymentID

           

          http://localhost:8080/business-central/rest/history/instance/1

          ~~~

          <process-instance-log>

              <process-instance-id>1</process-instance-id>

              <process-id>Project.TestProcess</process-id>

              <start>2016-07-04T10:50:59+05:30</start>

              <status>1</status>

              <parent-process-instance-id>-1</parent-process-instance-id>

              <outcome xsi:nil="true" />

              <identity>abhi</identity>

              <process-version>1.0</process-version>

              <process-name>TestProcess</process-name>

              <external-id>com.example.01652020:Project1:1.02</external-id>   <--DeploymentID

              <process-instance-description>TestProcess</process-instance-description>

          </process-instance-log>

          ~~~

          share thoughts on this approach.