Retrieving Call Activity elements
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2016 08:54 AM
Hi,
It looks like Activiti doesn't auto-deploy Call Activities when they are encountered within a parent process (would be a great plus if it did!).
Is there an API from one of the services that can give a list of call activities that need to be deployed before the parent process is deployed?
This would make is much easier to deploy them.
Or, do I have to add this my self (e.g. traverse the xml)
Thanks,
Peter
It looks like Activiti doesn't auto-deploy Call Activities when they are encountered within a parent process (would be a great plus if it did!).
Is there an API from one of the services that can give a list of call activities that need to be deployed before the parent process is deployed?
This would make is much easier to deploy them.
Or, do I have to add this my self (e.g. traverse the xml)
Thanks,
Peter
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2016 01:35 PM
So I've retrieved the calledElement sub-process names, and I deploy() them using the repositoryService.
But when I start the parent process (from the runtimeService derived from the very same repositoryService), I get an exception:
org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'tester'
I've tried this with and without a tenantId.
Note: There seems to be a mixing of names in Activiti as when I deploy a non-CallActivity process, the 'key' in startProcessInstanceByKey() is really the 'id' attribute inside the xml. Maybe the 'key' is meant to be something else? Semantics aside..in any case:
I can deploy the calledElement just fine using this code:
<code>
InputStream distream = new FileInputStream(BPMN_FOLDER + dependency + BPMN_EXTENSION);
DeploymentEntity depdeply = (DeploymentEntity) repositoryService.createDeployment().name(dependency).addInputStream(dependency, distream).tenantId(tenantId).deploy();
</code>
Where 'dependency' is the id of the calledElement value.
I deploy the parent process no problem with:
<code>
DeploymentEntity deployment = (DeploymentEntity) repositoryService.createDeployment().name(bpmnFile.getName().substring(0, bpmnFile.getName().lastIndexOf(".bpmn20"))).addInputStream(bpmnFile.getName(), istream).tenantId(tenantId).deploy();
</code>(note: same is true if I use the 'no-tenantid' version of the above)
The exception is thrown when I attempt to start the parent process:
<code>
processInstance = runtimeService.startProcessInstanceByKeyAndTenantId(key, key, variableMap, tenantId);
</code>
As I understand it, a call activity sub process needs to be deployed before its parent is deployed/started (but not starting the sub-process). The deploy() call seems to suggest it registers the deployment with the repositoryService, as it looks to be a wrapper for repositoryService.deploy(this).
Why is the parent start api call not finding the successfully deployed call activity sub-process?
Many thanks for any help/advice,
Peter
But when I start the parent process (from the runtimeService derived from the very same repositoryService), I get an exception:
org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'tester'
I've tried this with and without a tenantId.
Note: There seems to be a mixing of names in Activiti as when I deploy a non-CallActivity process, the 'key' in startProcessInstanceByKey() is really the 'id' attribute inside the xml. Maybe the 'key' is meant to be something else? Semantics aside..in any case:
I can deploy the calledElement just fine using this code:
<code>
InputStream distream = new FileInputStream(BPMN_FOLDER + dependency + BPMN_EXTENSION);
DeploymentEntity depdeply = (DeploymentEntity) repositoryService.createDeployment().name(dependency).addInputStream(dependency, distream).tenantId(tenantId).deploy();
</code>
Where 'dependency' is the id of the calledElement value.
I deploy the parent process no problem with:
<code>
DeploymentEntity deployment = (DeploymentEntity) repositoryService.createDeployment().name(bpmnFile.getName().substring(0, bpmnFile.getName().lastIndexOf(".bpmn20"))).addInputStream(bpmnFile.getName(), istream).tenantId(tenantId).deploy();
</code>(note: same is true if I use the 'no-tenantid' version of the above)
The exception is thrown when I attempt to start the parent process:
<code>
processInstance = runtimeService.startProcessInstanceByKeyAndTenantId(key, key, variableMap, tenantId);
</code>
As I understand it, a call activity sub process needs to be deployed before its parent is deployed/started (but not starting the sub-process). The deploy() call seems to suggest it registers the deployment with the repositoryService, as it looks to be a wrapper for repositoryService.deploy(this).
Why is the parent start api call not finding the successfully deployed call activity sub-process?
Many thanks for any help/advice,
Peter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2016 03:28 PM
Hi,
I'm going to answer my own question here, as I have found a solution (of sorts):
The reason for the ActivitiObjectNotFoundException is because the 'name' field in the DeploymentBuilder MUST be the file path name - i.e. it needs to include file path information (relative or absolute) because deploy() builds the deployment ready for execution, but it isn't until the parent process actually executes the Call Activity at runtime that the file is referenced and the instance built.
Hopefully this will help others experiencing this when using file-based deployments.
RFE: It would be *REALLY* fantastic if Activiti could automatically build and deploy Call Activities - kind of like what Bonita does for Call Activities (but..remember that the Activiti engine generally runs faster than Bonita and is *way* more portable :-).
Thanks,
Peter
I'm going to answer my own question here, as I have found a solution (of sorts):
The reason for the ActivitiObjectNotFoundException is because the 'name' field in the DeploymentBuilder MUST be the file path name - i.e. it needs to include file path information (relative or absolute) because deploy() builds the deployment ready for execution, but it isn't until the parent process actually executes the Call Activity at runtime that the file is referenced and the instance built.
Hopefully this will help others experiencing this when using file-based deployments.
RFE: It would be *REALLY* fantastic if Activiti could automatically build and deploy Call Activities - kind of like what Bonita does for Call Activities (but..remember that the Activiti engine generally runs faster than Bonita and is *way* more portable :-).
Thanks,
Peter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2016 04:29 AM
To answer your question: you can traverse the process in java, by calling the repositoryService.getBpmnModel.
However, I'm not sure what the use case is … how would an auto deploy look like? Activiti can't start looking on the filesystem … it can only deploy and check what your provide to the engine when doing the deployment.
However, I'm not sure what the use case is … how would an auto deploy look like? Activiti can't start looking on the filesystem … it can only deploy and check what your provide to the engine when doing the deployment.
