Camunda ist ein kostenloses [[bpm|BPM]] tool. Es unterstützt [[bpm#cmmn|CMMN]] sowie [[bpm#dmn|DMN]]. Ausserdem unterstützt es externe Tasks mit Hilfe von z.B [[soap|SOAP]] oder integrierter [[https://docs.camunda.org/manual/7.5/reference/rest/|REST API]]. Siehe [[REST]] Integration mit [[openkm|OpenKM]] Api möglich. (CMIS specification) Mit Hilfe des [[coding:java|Java]] [[spring-framework|Spring Framework]] ist es einfach, eigenständige Programme für Geschäftspraktiken- und abläufe zu entwickeln. Um ein Berechtigungskonzept zu implementieren muss das [[https://docs.camunda.org/manual/7.5/user-guide/process-engine/authorization-service/|Authorisation service]] aktiviert werden! Besser ist eine [[https://docs.camunda.org/manual/7.8/installation/full/tomcat/configuration/#ldap|direkte Anbindung an LDAP]]. Siehe auch [[https://forum.camunda.io/t/how-to-setup-ldap-in-camunda-platform-run/26553]] [[https://stackoverflow.com/questions/73399333/camunda-ui-tasklist-slider-overlaps-tasks-in-new-chrome-edge-versions|Chrome Bug Column Size]] Increase max-file-size - **NOT with Camunda Run**? - Siehe [[https://forum.camunda.io/t/how-to-increase-the-max-file-upload-size-in-generated-forms/38264|Frage im Forum]]. [[https://docs.camunda.org/manual/7.17/user-guide/task-forms/#embedded-task-forms|Usertask embedded form Docs]] - reference using 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 Die Variablen Typen (String, Double,...) müssen Groß geschrieben sein!!!!!
Javascript Zugriff auf Prozess Variablen

{{stefan}}

{{walter}}

=====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]]