Hi
I’m trying to build a bpmn process which includes dmn as well as part of the process for example my bpmn looks like this [startevent->dmn file → dmn file ->so on dmnfile…-> endevent ]
The requirement is to start the process from other spring boot project not with any forms. So the output shall be list .
Thanks Niall, but my input json does’t have any value like the following, How do I handle this case
{
“variables”: {
“aVariable” : {
“value” : “aStringValue”,
“type”: “String”
},
“anotherVariable” : {
“value” : true,
“type”: “Boolean”
}
},
“businessKey” : “myBusinessKey”
}
Maybe you should abstract your BPMN from your API. To your client, you should present a nice REST Api, like we use to build with @RestController.
So when you receive a call in your REST Api, use java to start an instance of your process, passing some input variables in it. This way you can transform your input DTO to any kind of variable you want in your process, and in the future you can change your process variables without breaking changes to your API Clients.
Example:
@RestController
public class ProductController {
@Autowired
private RuntimeService runtimeService;
@ApiOperation(value = "execute a product process")
@PostMapping(value = "products")
public String createProduct(@RequestBody ProductInputDTO input) {
return runtimeService.createProcessInstanceByKey("my-process-definition")
.setVariable("name", input.getName())
.setVariable("value", input.getValue())
.execute()
.getProcessInstanceId();
}
}
If you know your process will end automatically and you need to get some data to return to your API Client, you can change the “.execute()” to “.executeWithVariablesInReturn()”. This will return a “ProcessInstanceWithVariables” and you can get the variables generated by the process from that object, and then map it to your desired output DTO.
Hmm, but the endpoint you are trying to call is from your webservice, described as a @RestController?
if its is, then maybe its not a camunda problem but a general springboot microservice problem.
If you find a way to share with me a simplified copy of your project with this problem by direct message here, i`ll be happy to try and help you with it.