Dynamic Deployment to the Camunda Engine

Hello,
I built RESTfull web application that can read BPMN file from the user and allow him make some change in the uploaded model (for example add groovy script to a script task) , now I want to deploy the modified model to the Camunda engine by using rest API and return the result execution of that model to the web application as response message . In other words, Is it possible to use Camunda engine as a service that I can send a post request with a model to be deployed , executed and get the execution result as a response message.
I 'd appreciate if you kindly give me some suggestions.

Best regards,

@AlioPro can could chain some API calls together and use use the Message Event to ping your web application with the response.

  1. Deploy Process
  2. Start Process using Process Key (use async after on your start event)
    1.1. Created Process Instance reaches message event in process and the message event (or service task or send task) calls a web service from your web application with the response data.

Hi Stephen,

I believe there is a new feature in 7.6 where process variables can be returned as part of the start API. Hence conceptually your process model could realise a remote procedure call…

regards

Rob

Any docs on this? Sounds interesting! Was thinking the other day something like his would be super valuable.

Hey @StephenOTT,

yes there is documentation on this. See for the documentation of the Java public API here and for the REST API here.

Best regards,
Chris

thanks! @Zelldon much appreciated

Thanks @Zelldon and @StephenOTT for your suggestions

Dear @Zelldon

I used embedded-spring-rest as from https://github.com/camunda/camunda-bpm-examples/tree/master/deployment/embedded-spring-rest . Then deployed its war file to Red Hat OpenShift Container Platform ,so this will enable me to call Camunda REST API . After followed Camunda documentations for REST API, I deployed three models and could see it’s process-definitions as can see here:
http://mytomcatapp-deploymentali.rhcloud.com/camundaService/deployment/.
http://mytomcatapp-deploymentali.rhcloud.com/camundaService/process-definition/.

Now the problem is I can’t use the services for start process instance by key or id . Whenever I use these services , I’ll get error 415 (Unsupported media type), and two of the uploaded process do not contain any variables.
I spend all the day thinking about it without any success .
Actually, I don’t know what I missing here. Can you please help me with this problem ?

Best Regards,

Hey @AlioPro,

how does your request look like?
415 (Unsupported media type) means you use a media type, with your request, which is not supported by the server. Make sure that you use application/json as media type and send at least an empty json object ({ }) on starting a process instance. See for more information the REST API documentation.

Best regards,
Chris

Hey @Zelldon ,

Thank you very much for your notes. The problem was, I did not add application/json in the request header.
I use Advance REST Client to call services, process instances for models contain script task is created on my Localhost, Now the problem is, I could not deploy models contain service task which implemented by using HTTP-connector.

When I call ( /deployment/create) service , I will get
("ENGINE-09005 Could not parse BPMN process. Errors: * One of the attributes ‘class’, ‘delegateExpression’, ‘type’, or ‘expression’ is mandatory on serviceTask) since I did n’t specify (class or delegateExpression or delegateExpression ) but I used (bpmn2:extensionElements) for http- connector.

These models are executable when I made JUnite test as mentioned here
camunda-bpm-examples/servicetask/rest-service at master · camunda/camunda-bpm-examples · GitHub.
In case, set the Expression property of service task to ${true}, then the model will be deployed but without calling the REST service inside the HTTP-connector when Process Instance started.

So, Is there any way to deploy a model contain service task (that executed with http-connect) using REST API?

I am sorry if this sounds like a silly question.

simpleServiceTask.bpmn (4.5 KB)
invokeRestService.bpmn (7.4 KB)

Best Regards,