AnsweredAssumed Answered

Activiti nested subprocess issues

Question asked by ciarancorson1 on Apr 14, 2016
Latest reply on Apr 20, 2016 by ciarancorson1

I'm working on something in work, and can't figure out where the issue resides - Activiti or in our RestTemplate calls. We're using 5.16.1
We're using activiti as a dependency in a service, where it handles various patterns like sub process nesting, and other complicated patterns. Lately we've been testing an approach to allow this nested subprocess pattern with sub processes being called by other sub processes. ie A calls B which calls C. As part of it we have some tests. One of them is where BPMN has 2 tasks.  BPMN "A" and BPMN "B" are deployed and present in the act_ge_bytearray tables. BPMN "C" is not deployed, and we expect an error to occur.

BPMN "A" has a task: CreateType. "A" then has a sub process, described in BPMN "B". 
"B" has a task: CreateType. "B" then has a task to call a subprocess in BPMN "C", which  is not currently deployed. This is expected. We want it to fail to test something.
The method findDeployedLatestProcessDefinitionByKeyAndTenantId() in DeploymentManager throws an ActivitiObjectNotFound exception.
"no processes deployed with key TestBPMNFail for tenant identifier CC".
I've noticed that the class executing this class (CommandContext, performOperation() ),  only has a try and finally. Where is the exception handled after this?

When I run this this test using our service, the complete task for B fails in CreateType, due to C not existing. It gives us a 404 Not Found back as the exception message.  We don't get back the error message raised from the DeploymentManager class. Should we? However, when I enable debug logging for org.activiti, we get the full message back in the activiti logs.  We're using RestTemplate to post from our service into activiti. We're using an errorHandler to deal with the http exception codes from activiti, the error codes return standarised messaged defined by activiti.

When I use curl to manually complete the command: "curl -POST 'http://localhost:port/activiti/runtime/tasks/{taskId} -d '{"action" : "complete"}'" , I get the proper error message as shown above. 

What's the cause here? I was thinking that a complete task called by curl will call activiti directly. and a call made by our rest template is in a runtime engine so it's not aware of the exception, only the http request and response.
I'll be able to add more information tomorrow when I am back in work.