PV207 BPM Labs Building Intelligent Applications with Kogito Mgr. Ivo Bek Senior Product Manager Mgr. Marian Macik Senior Quality Engineer April 2022 1 2 KOGITO ● Domain-Driven Development ● Generated Domain-specific APIs from your BPMN and DMN models ● Lightweight orchestration microservices ● Event-driven business logic ● Dev-mode hot reload ● Distributed sagas for microservices ● Serverless workflows ● Polyglot programming More info at ● Blogs ● Youtube https://kogito.kie.org/ 3 PREREQUISITES ● Java 11 with JAVA_HOME configured ● Visual Studio Code ● Kogito Bundle Extension for VS Code ● Docker (only for Dev UI) 4 YOUR FIRST KOGITO APPLICATION ● Generate a preconfigured Quarkus application with Kogito extension at code.quarkus.io ○ Generate your application -> Download as a zip ○ Version without Dev UI available here ● Design BPMN/DMN in src/main/resources folder ○ VS Code ○ bpmn.new ● myProcess ● Start the application in development mode ○ ./mvnw clean compile quarkus:dev ● Domain-specific API available at http://localhost:8080/q/swagger-ui/ ○ OpenAPI specification ○ Generated only in development mode by default 5 YOUR FIRST KOGITO APPLICATION ● Start the process using Swagger UI ● Go to http://localhost:8080/q/dev/ and select Process Instances under on the Kogito Runtime Tools card ● Look at the process in detail ● Same for the task, although it will be just listed, details will be unavailable due to a missing form Dev UI (only available with Docker) 6 YOUR FIRST KOGITO APPLICATION ● Change the greeting phrase ○ Edit an asset, e.g. the script task ○ Execute a command to invoke the Kogito endpoint again ○ Asset is recompiled and a new version is invoked ● Compile ○ ./mvnw clean install ○ Append -Dquarkus.swagger-ui.always-include=true to include Swagger UI in production ● Run ○ java -jar target/quarkus-app/quarkus-run.jar ○ Application uses whole quarkus-app directory ● Run on a different port ○ java -Dquarkus.http.port=8090 -jar target/quarkus-app/quarkus-run.jar 7 YOUR FIRST KOGITO APPLICATION ● Start a process curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"personName" : "John"}' http://localhost:8080/myProcess ● Show processes curl -H 'Accept:application/json' http://localhost:8080/myProcess ● Show Tasks curl -H 'Accept:application/json' http://localhost:8080/myProcess/{puuid}/tasks?user=admin ● Complete a task curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"personName" : "John Doe"}' http://localhost:8080/myProcess/{puuid}/{taskName}/{tuuid}?user=admin “Raw commands” 8 KOGITO EXAMPLES https://github.com/kiegroup/kogito-examples KAFKA MESSAGE EVENTS process-kafka-quickstart-quarkus TIMERS process-timer-quarkus 4-EYE PRINCIPLE process-usertasks-quarkus …and more Thank you, questions? 9