Use Camunda to deploy bpmn, dmn... and other API's

This might be too broad of a question but I was hoping to get a gut feeling from the community. I am part of a team that is trying to expose Camunda as SaaS within the enterprise. As part of the offering, we need to expose the capability of deploying a bpmn model and its dependent objects (sub processes, dmn models, forms…), which some of them could live outside of camunda. All of those would be bundled into a “project”, which would be deployed as a unit. In case any of those fail, the entire project and its objects need to be able to be “rolled back.” Assuming that anything living outside of Camunda could be deployed and rolled back using some API, my questions are the following:

  • Is Camunda a sensible use case to be used as an orchestration engine for such a scenario?
  • Has anyone used Camunda as an orchestration engine to deploy (and rollback) objects inside and outside of Camunda?
  • I have been looking at compensation events for rolling back some of the failing deployments. Is it a good / bad idea?
    Feel free to ask for more details is any of this is not clear. Thank you.
  1. This use case seems quite normal
  2. Camunda has a very good versioning implementation so deplying something an re-deploying an old version is quite easy. With regard to other non- bpmn artifacts, they can just be replaced when deployed. It kinda depends on how you decided to deploy things.
  3. compensation - if you’re talking about the BPMN implementation isn’t really relevant here as it only refers to running instances.

Thank you for the quick reply. I will try to model simple processes and share them along the way to see if I am on the right track. Cheers.

Niall,
I have a follow up question as I am running into an issue trying to use a service task to with an http-connector using a Javascript script trying to post a “file” type of variable. I saw this post that seems to be bumping into the same issue. To summarize, I was able to start a process sending a file in and I can see the bpmn file as a variable in camunda and I can download it.


My problem is that I cannot a find a way to send the file (store in ‘fileToDeploy’) back to the /deployment/create camunda API. When I try to decode the file and store it into a variable, I get an exception telling me that the variable is too large. This is the code for the payload I was trying to put together.

var payload =
{
“deployment-name”: “model_deployment”,
“enable-duplicate-filtering”: “false”,
“deployment-source”: “automation”,
“bpmnFile”: {
“value”: execution.getVariable(“fileToDeploy”),
“options”: {
“filename”: execution.getVariable(“fileName”),
“contentType”: null
}
}
}
JSON.stringify(payload);
How do I get an handle on the execution.getVariable(‘fileToDeploy’) in such a way that I can send it back out? Thank you for your help. Cheers.

I think I found a way to send the payload back thanks to the Groovy example without having to store any variables within Camunda. See code below.

import groovy.json.JsonOutput

def doc = execution.getVariableTyped(“fileToDeploy”).getValue()
def obj = new LinkedHashMap();

obj[“deployment-name”] = “model_deployment”
obj[“enable-duplicate-filtering”] = “false”
obj[“deployment-source”] = “automation”

obj.bpmnFile = new LinkedHashMap();
obj.bpmnFile.value = doc.bytes.encodeBase64().toString()

obj.bpmnFile.options = new LinkedHashMap();
obj.bpmnFile.options.filename = execution.getVariable(“fileName”)
obj.bpmnFile.options.contentType = null

JsonOutput.toJson(obj)

I then used the following line to decode the value of the bpmn file within the node api we built in front of the camunda API;

let buff = new Buffer(payload.bpmnFile.value, ‘base64’);
let xml = buff.toString(‘ascii’);

I hope this makes sense. I am pretty sure there is a better way. Please let me know.