cancel
Showing results for 
Search instead for 
Did you mean: 

How to get ProcessDefinitionId from a programmatic deployment?

jwestra
Champ in-the-making
Champ in-the-making
Hi!

I am trying to understand versioning and process definition Ids.
I have a JUnit test case that builds a BpmnModel and deploys it twice. 

I see the process definition Id is in this format:

Process.java's "id" + ":"+ version + ":" + <strong>some other number</strong>".

In my logs (see below), the "some other number" is consistently a 4 on the initial deploy and then 13 on the second deploy.

What is last part of the process definition id?

Second, because I do not know how the processDefinitionId is formed, I have to create a new Process instance and then ask it for it's definition.  I want to avoid that and instead, simply call RuntimeService.getProcessDefinition(processDefinitionId) to get my ProcessDefinition object.

<code>
10:48:27,305 INFO  [BpmnDeployer] Processing resource dynamic-model-redeploy.bpmn
First DeploymentId is: 1
ProcessDefinitionId for first deployment is : my-process:1:4
10:48:42,265 INFO  [BpmnDeployer] Processing resource dynamic-model-redeploy.bpmn
Second DeploymentId is: 10
ProcessDefinitionId for second deployment is : my-process:2:13
<code>
2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

the "second" number id generated from idGenerator. The default id generator is org.activiti.engine.impl.db.DbIdGenerator. (incremental id genrator based on the used db.)
You can use another one if you want to.
e.g.:http://activiti.org/userguide/index.html#advanced.uuid.generator

You can get process definition id from org.activiti.engine.RepositoryService#createProcessDefinitionQuery

Regards
Martin

Regards
Martin

jwestra
Champ in-the-making
Champ in-the-making
Martin,

OK, I got the repository query working with singleResult() back on the deploymentId that was generated when I did the deploy() call.  With that, I am all set.  Thanks a lot!

Jason