embedded:deployment:form.html
[[https://github.com/camunda/camunda-external-task-client-js/blob/master/README.md|external-task-client-js dok]]
[[https://docs.camunda.org/get-started/spring-boot/|Spring Boot example project]]
[[https://downloads.camunda.cloud/release/camunda-bpm/|Download archive]]
[[https://github.com/zarat/camunda-cockpit-plugins|Minimal history Plugin]]
=====Authorization=====
* Process definition - Wer darf welchen Prozess starten
* Filter - Wer darf Filter einstellen
* Process definition - darf im cockpit und in der tasklist die deployten prozesse und diagramme sehen
* ProcessInstance CREATE - darf Prozesse starten (damit Subprozesse nicht startbar sind gibt es den Punkt tasklist -> startable in modeller)
=====MySQL Setup=====
[[https://groups.google.com/g/camunda-bpm-users/c/O8dpppcvwt8/m/MXFGeGW8wxoJ|Connect Camunda to MySQL Database instead of H2]]
[[https://forum.camunda.io/t/mysql-configuration-for-springboot-app/38547|Spring Boot right MySQL Driver Installation und connection]]
=====CMMN=====
Um im Camunda modeler das CMMN Modul zu aktivieren startet man das Programm mit dem Parameter
--no-disable-cmmn
=====DMN=====
DMN (Decision making notation) ist eine Auszeichnungssprache für automatisierte Entscheidungen.
[[https://docs.camunda.org/manual/7.17/reference/rest/decision-definition/post-evaluate/|Evaluate a decision via REST api]]
=====Installation=====
====Docker====
Camunda Run 7
docker pull camunda/camunda-bpm-platform:latest
docker run -d --name camunda -p 8080:8080 camunda/camunda-bpm-platform:latest
docker container start camunda
docker container stop camunda
Camunda Platform 8
git clone https://github.com/camunda/docker-camunda-bpm-platform
cd docker-camunda-bpm-platform
docker compose up -d
=====REST API=====
====Authentication====
In file $CAMUNDA_HOME/server/apache-tomcat/webapps/engine-rest/WEB-INF/web.xml
uncomment the lines for basic auth.
====deploy a process====
POST localhost:8080/engine-rest/deployment/create
Content-Type: multipart/formdata
file: upload
====Evaluate a process/decision====
====start a process====
POST localhost:8080/engine-rest/process-definition/key/[process-name]/start
Content-Type: application/json
Raw: { /* some initial parameters */ }
====Assign a running task to a user====
POST localhost:8080/engine-rest/task/[task-id]/assignee
Content-Type: application/json
data: {"userId": "[user-id]"}
====Get variables from a running task====
GET localhost:8080/engine-rest/task/[task-id]/variables
====delete a started task====
DELETE localhost:8080/engine-rest/process-instance/[process-instance-id]
====delete a deployed process====
DELETE localhost:8080/engine-rest/process-definition/key/[process-name]
=====Scripting=====
====Python====
pip install camunda-external-task-client-python3
import logging
from camunda.external_task.external_task_worker import ExternalTaskWorker
from examples.task_handler_example import handle_task
logger = logging.getLogger(__name__)
default_config = {
"maxTasks": 1,
"lockDuration": 10000,
"asyncResponseTimeout": 0,
"isDebug": False,
}
def main():
#configure_logging()
while 1:
try:
ExternalTaskWorker(worker_id=1, config=default_config).fetch_and_execute(topic_names=["SendLetter"], action=handle_task)
except:
print("No tasks found")
def configure_logging():
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", handlers=[logging.StreamHandler()])
if __name__ == '__main__':
main()
Pure REST
import requests
import json
import time
url = 'http://localhost:8080/engine-rest/execution'
task = {}
try:
res = requests.post(url, json=task)
#print(res.status_code)
body = res.text
except:
print('The engine seems to be down.')
while body == '[]':
res = requests.post(url, json=task)
time.sleep(5)
if body != '[]':
break
response = json.loads(body)
print(response[0]['id'])
====NodeJS====
Siehe [[https://github.com/camunda/camunda-external-task-client-js|Camunda External Task NodeJS - Github]]
npm install -s camunda-external-task-client-js
npm install -s mysql
const { Client, logger } = require("camunda-external-task-client-js");
const { Variables } = require("camunda-external-task-client-js");
const config = { baseUrl: "http://localhost:8080/engine-rest" };
const client = new Client(config);
// using mysql database
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
database: "test",
password: ""
});
con.connect(function(err) {
console.log("Connected!");
con.query("SELECT * FROM books;", function (err, result) {
for(var i = 0; i < result.length; i++)
console.log("Result: " + result[i]['title']);
});
});
client.subscribe("Rechnung", async function({ task, taskService }) {
console.log("*** Processing task " + task.id);
var uploadedFile = task.variables.get("rechnung");
const http = require('http');
const fs = require('fs');
const file = fs.createWriteStream("C:/Users/mzarat/Desktop/" + task.id + "_test.pdf");
const request = http.get("http://localhost:8080/engine-rest" + uploadedFile.remotePath, function(response) {
response.pipe(file);
// after download completed close filestream
file.on("finish", () => {
file.close();
console.log("*** The file was saved at C:/Users/mzarat/Desktop/" + task.id + "_test.pdf");
});
});
const processVariables = new Variables();
//processVariables.set("testIndex", "1");
// complete the task
await taskService.complete(task, processVariables);
//console.log("*** Task " + task.id + " completed.");
});
=====Embedded task form=====
Wird im Modeler als zusätzliche Datei geaddet und referenziert mit
embedded:deployment:file.html
Javascript Zugriff auf Prozess Variablen
=====Links=====
* [[https://camunda.com|Homepage]]
* [[https://docs.camunda.io/|Docs]]
* [[https://forum.camunda.io/|Forum]]
* [[https://docs.camunda.org/manual/7.5/reference/rest/|REST API Docs]]
* [[https://www.postman.com|Postman REST Client]]
* [[https://www.youtube.com/playlist?list=PLJG25HlmvsOX8TiIGUZcVW-ez053YsOX0|Camunda tutorial playlist]]
* [[https://www.youtube.com/watch?v=WC3Oh_E-Btk|New way of forms 2021]]
* [[https://www.youtube.com/watch?v=OME54prHPME|Camunda Connectors, data, scripting]]
* [[https://www.youtube.com/watch?v=8SYEc3dHnM4|Messaging tutorial]]
* [[https://www.youtube.com/watch?v=k-rS2CujP8k|External Task]], [[https://camunda.com/blog/2021/03/external-task-client-spring-bootified/|External task 2]]
* [[https://www.youtube.com/watch?v=6GHp55PGt_U|Trigger timer and error events tutorial]]
* [[https://www.youtube.com/watch?v=BwsoozZRAqo|Cockpit development]]
* [[https://www.youtube.com/watch?v=sgcSm7YneTs|Build Spring Boot Application]]
* [[https://www.youtube.com/playlist?list=PLJG25HlmvsOVssaiPmavxv3htN_dXS3BW|Spring Boot Application 2]]
* [[https://www.youtube.com/watch?v=T8dWMFSMJNE|Decision making]]
* [[https://github.com/camunda/camunda-docs-manual/blob/master/content/user-guide/process-engine/scripting.md#use-script-tasks|Scripting]]
* [[https://medium.com/@stephenrussett/deploying-embedded-forms-with-camunda-rest-api-84cf8010f8c1|Embedded form deployment]]
* [[https://www.youtube.com/watch?v=BwsoozZRAqo|Building a cockpit plugin]]