diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/README.md b/kogito-quarkus-examples/process-instance-migration-quarkus/README.md new file mode 100644 index 0000000000..098d29480e --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/README.md @@ -0,0 +1,278 @@ +# Process Instance Migration (PIM) example + +## Description + +This example showcases the Process Instance Migration (PIM) functionality. This feature can be used to migrate +active process instances from one process definition (v1) to another (v2). + +This example is using the *Compact Architecture* that is based on simplified communication among the different +*Kogito* services without the need of events (Kafka/HTTP) between them. Note that this design choice is unrelated +to the Process Instance Migration functionality. + +## The test processes + +### The original BPMN Process + +
+
+ Simple Process Diagram +
Simple Process Diagram
+
+
+ +The process follows a very basic design with two script tasks and a catching signal event in between to act as a wait state. + +
+
+ Modified Process Diagram +
Modified Process Diagram
+
+
+ +The modified version of this simple process has own additional script task **after** the wait state. + + +## Running the example +### Prerequisites + +* Java 17+ installed +* Environment variable JAVA_HOME set accordingly +* Maven 3.9.3+ installed +* Docker and Docker Compose to run the required example infrastructure. + +And when using native image compilation, you will also need: +- GraalVM 20.3+ installed +- Environment variable GRAALVM_HOME set accordingly +- GraalVM native image needs as well native-image extension: https://www.graalvm.org/reference-manual/native-image/ +- Note that GraalVM native image compilation typically requires other packages (glibc-devel, zlib-devel and gcc) to be installed too, please refer to GraalVM installation documentation for more details. + +### Infrastructure Services + +This quickstart provides a docker compose template that starts all the required services. This setup ensures that all services are connected with a default configuration. + +- PostgreSQL: 5432 +- Data Index: 8180 +- PgAdmin: 8055 +- Kogito Process Instance Migration Service: 8080 + +To help bootstraping the Infrastructure Services, the example provides the `startServices.sh` script inside the *docker-compose* +folder. + +> **_NOTE_**: the docker compose template requires using _extra_hosts_ to allow the services use the host network, this may +> carry some issues if you are using a **podman** version older than **4.7**. + +### Building & Running the example + +To build the example, on a Terminal, run the following command: +```shell +mvn clean package -Pcontainer +``` +This will build the example quarkus application and create a Docker image that will be started in the `docker-compose` template. + +To execute the full example (including consoles), open a Terminal and run the following command inside the `docker-compose` folder: + +```shell +sh startServices.sh +``` + +Additionally, if you want to start only the example and the minimal Infrastructure Services (PostgreSQL, Data-Index and Jobs Service), +you can run the same `startServices.sh` script but passing the `example` argument + +```shell +sh startServices.sh example +``` + +> **_NOTE:_** starting the Infrastructure Services, please consider running a ```mvn clean package -Pcontainer``` +> command on the project root before running the ```startServices.sh``` script for the first time or any time you modify the project. + +### Running the example in Development mode + +To run the example in Development mode, just run the following command in a Terminal: + +```shell +mvn clean package quarkus:dev -Pdevelopment +``` + +The Development Mode will embed all the needed Infrastructure Services (PostgreSQL, Data-Index & Jobs Service) and won't +require any extra step. + +The `development` profile includes the **Runtime Tools Quarkus Extension** that exposes a new section in the **Quarkus Dev-UI** +unifying the **Management Console** & **Task Console** functionalities. **Quarkus Dev-UI** is available at http://localhost:8080/q/dev + +> **_NOTE:_** For more information about how to work with Kogito Runtime Tools Quarkus Extension, please refer to the [Kogito Documentation](https://docs.kogito.kie.org/latest/html_single/#con-runtime-tools-dev-ui_kogito-developing-process-services) page. + +### Executing an instance of the Simple Process + +Once the service is up and running you can start an instance of the **Simple** process by a sending request to `http://localhost:8080/simple`. + + +In a Terminal you can execute this curl command to start a **Simple** process: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/simple -d '{}' +``` + +If everything went well you may get a response like: +```json +{ + "id": "b97efe7d-dc9b-4da8-8b3e-6100f8d8b045" +} +``` + +In the console of the example container you should see the following log message: +``` +Started process e4bf4948-1f56-4ee3-9f2c-5010aaf50701 [simple, v1.0] +``` + +To finish this process instance, execute the following command, using the process instance id previously returned, to send a signal: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/simple/e4bf4948-1f56-4ee3-9f2c-5010aaf50701/continue -d '{}' +``` + +In the console of the example container you should see the following log message: +``` +Ending process e4bf4948-1f56-4ee3-9f2c-5010aaf50701 [simple, v1.0] +``` + +### Using PIM to migrate a process instance from the Simple Process to the Modified Process + +In a Terminal, start another instance of the **Simple** process: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/simple -d '{}' +``` + +Note the new process instance id that is returned by the engine: +```json +{ + "id": "2a507f63-9db1-4d15-b64c-9e14f922d470" +} +``` + +Using the Management API, the following two endpoints can be used to migrate active process instances: +* `/management/processes/{processId}/migrate`: Use this endpoint to migrate **all** active process instances of a given `processId` to a new target process definition +* `/management/processes/{processId}/instances/{processInstanceId}/migrate`: Use this endpoint to migrate a specific process instance of a given `processId` to a new target process definition + +In a Terminal, invoke the Management API to migrate the newly created process instance: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/management/processes/simple/migrate -d '{ + "targetProcessId": "modified", + "targetProcessVersion": "1.0" +}' +``` + +The response will contain information about the migration: +```json +{ + "message":"All intances migrated", + "numberOfProcessInstanceMigrated":1 +} +``` + +Note that the invocation of the `migrate` endpoint is the first step of the PIM functionality. It flags the selected process instance(s) as migrated to the defined target process definition. The second step of the migration will happen the next time the process instance is unmarshalled. This would be the case when the process instance is triggered to continue its execution. If you want to test whether this unmarshalling step is successful after the migration, the following PUT call can be used without triggering the execution of the process instance: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X PUT http://localhost:8080/modified/2a507f63-9db1-4d15-b64c-9e14f922d470 -d '{}' +``` + +If successful, this call will just return the processInstanceId of the process instance. + + +To finish this process instance, execute the following command, using the process instance id previously returned, to send a signal against the endpoint of the **Modified** process: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/modified/2a507f63-9db1-4d15-b64c-9e14f922d470/continue -d '{}' +``` + +In the console of the example container you should see the following log messages: +``` +Executing added node +Ending process 2a507f63-9db1-4d15-b64c-9e14f922d470 [modified, v1.0] +``` + +### Using PIM to migrate a process instance from the Simple Process to the Addedtask Process with a migration plan + +In the first migration example, the **Modified** process contained an added node after the current wait state. The wait state itself was unchanged in both process definitions, using the same internal node id. Therefore, no additional information had to be provided for the migration to be successful. + +Consider another modification of the original **Simple** process, this time adding a Human Task node **before** the Catching Signal Event: + +
+
+ Addedtask Process Diagram +
Addedtask Process Diagram
+
+
+ +With this change, the BPMN representation has changed in a way that the Catching Signal Event now has a different nodeId: + +**[src/main/resources/simple.bpmn](src/main/resources/simple.bpmn)** +```xml + +``` + +**[src/main/resources/addedtask.bpmn](src/main/resources/addedtask.bpmn)** +```xml + +``` + +In order to migrate process instances between process definitions with such changes, we need to provide a Migration Plan File (extension *.mpf). This file defines the migration plan with all required node mappings: + +**[src/main/resources/META-INF/migration-plan/addedtask_migration.mpf](src/main/resources/META-INF/migration-plan/addedtask_migration.mpf)** +```json +{ + "name" : "simple to addedtask migration", + "processMigrationPlan" : { + "sourceProcessDefinition" : { + "processId" : "simple", + "processVersion" : "1.0" + }, + "targetProcessDefinition" : { + "processId" : "addedtask", + "processVersion" : "1.0" + }, + "nodeInstanceMigrationPlan" : [ + { + "sourceNodeId" : "_8430CA7E-8CC6-4C2C-9664-6B5BBD5E36CB", + "targetNodeId" : "_1D65864A-96AF-44FC-92CE-2073B9FBA7D0" + } + ] + } +} +``` + +Now that we have this migration plan deployed with our new process, we can test the Process Instance Migration with the same steps as before. + +In a Terminal, start another instance of the **Simple** process: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/simple -d '{}' +``` + +Note the new process instance id that is returned by the engine: +```json +{ + "id": "29ec3980-9f0f-4b92-8a2d-394ffdb477e3" +} +``` + +In a Terminal, invoke the Management API to migrate the newly created process instance: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/management/processes/simple/migrate -d '{ + "targetProcessId": "addedtask", + "targetProcessVersion": "1.0" +}' +``` + +The response will contain information about the migration: +```json +{ + "message":"All intances migrated", + "numberOfProcessInstanceMigrated":1 +} +``` + +To finish this process instance, execute the following command, using the process instance id previously returned, to send a signal against the endpoint of the **Addedtask** process: +```bash +curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8080/addedtask/29ec3980-9f0f-4b92-8a2d-394ffdb477e3/continue -d '{}' +``` + +In the console of the example container you should see the following log messages: +``` +Ending process 29ec3980-9f0f-4b92-8a2d-394ffdb477e3 [addedtask, v1.0] +``` + diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/.gitignore b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/.gitignore new file mode 100644 index 0000000000..b6632dbda5 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/.gitignore @@ -0,0 +1,3 @@ +.env +svg/ +persistence/ \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/README.md b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/README.md new file mode 100644 index 0000000000..d12f83a931 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/README.md @@ -0,0 +1,49 @@ +# Kogito and Infrastructure services + +To allow a quick setup of all services required to run this demo, we provide a docker compose template that starts the following services: +- Postgresql +- PgAdmin +- Kogito Data Index +- Kogito Process Instance Migration Service (Only available if the example has been compiled using the `container` mvn profile eg: ```mvn cleanp package -Dcontainer```) + +The docker compose template provides three profiles to enable starting only the set of services you want to use. The profiles are: +- **infra**: Starts only the minimal infrastructure to run the example (Postgresql, pgadmin, Kogito Data Index) +- **example**: Starts the services in *infra* profile and the Kogito Example Service. Requires the example to be compiled using the `container` mvn profile eg: ```mvn cleanp package -Dcontainer```. + +> NOTE: In order to use it, please ensure you have Docker Compose installed on your machine, otherwise follow the instructions available +in [here](https://docs.docker.com/compose/install/). + +## Starting the services + +Use the `startServices.sh` passing the docker profile you want to use as an argument. If no profile is provided the script will default to **full**. + +Eg: +```shell +sh startServices.sh example +``` + +Once the services are started (depending on the profile), the following ports will be assigned on your local machine: +- Postgresql: 5432 +- PgAdmin: 8055 +- Kogito Data Index: 8180 +- Kogito Process Instance Migration Service: 8080 + +## Stopping and removing volume data + +To stop all services, simply run: + +```shell +docker compose stop +``` +or + +```shell +docker compose down +``` +to stop the services and remove the containers. + +For more details please check the Docker Compose documentation. + +```shell +docker-compose --help +``` diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml new file mode 100644 index 0000000000..774273c5ae --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/docker-compose.yml @@ -0,0 +1,83 @@ +version: '3' + +services: + postgres: + container_name: postgres + image: postgres:16.1-alpine3.19 + profiles: [ "infra", "example", "full" ] + ports: + - "5432:5432" + volumes: + - ./sql:/docker-entrypoint-initdb.d:Z + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-d", "kogito", "-U", "kogito-user" ] + timeout: 45s + interval: 10s + retries: 50 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:8.2 + profiles: [ "infra", "example", "full" ] + ports: + - 8055:80 + depends_on: + - postgres + volumes: + - ./pgadmin/servers.json:/pgadmin4/servers.json + - ./pgadmin/pgpass:/pgadmin4/pgpass + entrypoint: > + /bin/sh -c " + cp -f /pgadmin4/pgpass /var/lib/pgadmin/; + chmod 600 /var/lib/pgadmin/pgpass; + /entrypoint.sh + " + environment: + PGADMIN_DEFAULT_EMAIL: user@kogito.org + PGADMIN_DEFAULT_PASSWORD: pass + PGADMIN_CONFIG_SERVER_MODE: 'False' + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False' + GUNICORN_ACCESS_LOGFILE: '/dev/null' + + data-index: + container_name: data-index + image: quay.io/kiegroup/kogito-data-index-postgresql-nightly:${KOGITO_VERSION} + profiles: [ "infra", "example", "full" ] + ports: + - "8180:8080" + depends_on: + postgres: + condition: service_healthy + environment: + QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_USERNAME: kogito-user + QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + KOGITO_DATA_INDEX_QUARKUS_PROFILE: "http-events-support" + extra_hosts: + - "${DOCKER_GATEWAY_HOST}:host-gateway" + + kogito-process-instance-migration-service: + container_name: kogito-process-instance-migration-service + image: dev.local/${USER}/kogito-process-instance-migration-service:1.0-SNAPSHOT + profiles: ["example", "full"] + ports: + - "8080:8080" + depends_on: + data-index: + condition: service_started + environment: + QUARKUS_HTTP_CORS_ORIGINS: "/.*/" + QUARKUS_DATASOURCE_JDBC_URL: "jdbc:postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_REACTIVE_URL: "postgresql://postgres:5432/kogito" + QUARKUS_DATASOURCE_USERNAME: kogito-user + QUARKUS_DATASOURCE_PASSWORD: kogito-pass + QUARKUS_DATASOURCE_DB_KIND: postgresql + KOGITO_JOBS_SERVICE_URL: http://${DOCKER_GATEWAY_HOST}:8080 + KOGITO_SERVICE_URL: http://${DOCKER_GATEWAY_HOST}:8080 + KOGITO_DATAINDEX_HTTP_URL: http://${DOCKER_GATEWAY_HOST}:8180 + extra_hosts: + - "${DOCKER_GATEWAY_HOST}:host-gateway" diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/pgpass b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/pgpass new file mode 100644 index 0000000000..11a6f7c601 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/pgpass @@ -0,0 +1,3 @@ +postgres:5432:kogito:kogito-user:kogito-pass +postgres:5432:keycloak:kogito-user:kogito-pass +postgres:5432:postgres:kogito-user:kogito-pass \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/servers.json b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/servers.json new file mode 100644 index 0000000000..a112980d55 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "kogito", + "Group": "Servers", + "Host": "postgres", + "Port": 5432, + "MaintenanceDB": "kogito", + "Username": "kogito-user", + "SSLMode": "disable", + "PassFile": "/var/lib/pgadmin/pgpass" + } + } +} \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/sql/init.sql b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/sql/init.sql new file mode 100644 index 0000000000..92ea9b4e5c --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/sql/init.sql @@ -0,0 +1,33 @@ +CREATE ROLE "kogito-user" WITH + LOGIN + SUPERUSER + INHERIT + CREATEDB + CREATEROLE + NOREPLICATION + PASSWORD 'kogito-pass'; + +CREATE DATABASE kogito + WITH + OWNER = "kogito-user" + ENCODING = 'UTF8' + LC_COLLATE = 'en_US.utf8' + LC_CTYPE = 'en_US.utf8' + TABLESPACE = pg_default + CONNECTION LIMIT = -1; + +CREATE DATABASE keycloak + WITH + OWNER = "kogito-user" + ENCODING = 'UTF8' + LC_COLLATE = 'en_US.utf8' + LC_CTYPE = 'en_US.utf8' + TABLESPACE = pg_default + CONNECTION LIMIT = -1; + +GRANT ALL PRIVILEGES ON DATABASE postgres TO "kogito-user"; +GRANT ALL PRIVILEGES ON DATABASE kogito TO "kogito-user"; +GRANT ALL PRIVILEGES ON DATABASE kogito TO postgres; + +GRANT ALL PRIVILEGES ON DATABASE keycloak TO "kogito-user"; +GRANT ALL PRIVILEGES ON DATABASE keycloak TO postgres; \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh new file mode 100755 index 0000000000..8b0c6f4348 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/docker-compose/startServices.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +PROFILE="example" + +echo "Script requires your Kogito Example to be compiled" + +PROJECT_VERSION=$(cd ../ && mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + +echo "Project version: ${PROJECT_VERSION}" + +if [[ $PROJECT_VERSION == *SNAPSHOT ]]; +then + KOGITO_VERSION="latest" +else + KOGITO_VERSION=${PROJECT_VERSION%.*} +fi + +if [ -n "$1" ]; then + if [[ ("$1" == "infra") || ("$1" == "example")]]; + then + PROFILE="$1" + else + echo "Unknown docker profile '$1'. The supported profiles are:" + echo "* 'infra': Use this profile to start only the minimum infrastructure to run the example (postgresql, data-index & jobs-service)." + echo "* 'example': Use this profile to start the example infrastructure and the kogito-example service. Requires the example to be compiled using the 'container' profile (-Pcontainer)" + exit 1; + fi +fi + +echo "Kogito Image version: ${KOGITO_VERSION}" +echo "KOGITO_VERSION=${KOGITO_VERSION}" > ".env" +echo "COMPOSE_PROFILES='${PROFILE}'" >> ".env" + +if [ "$(uname)" == "Darwin" ]; then + echo "DOCKER_GATEWAY_HOST=kubernetes.docker.internal" >> ".env" +elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + echo "DOCKER_GATEWAY_HOST=172.17.0.1" >> ".env" +fi + +docker compose up \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/addedtask.png b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/addedtask.png new file mode 100644 index 0000000000..5745ce1575 Binary files /dev/null and b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/addedtask.png differ diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/modified.png b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/modified.png new file mode 100644 index 0000000000..e6c32497a2 Binary files /dev/null and b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/modified.png differ diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/simple.png b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/simple.png new file mode 100644 index 0000000000..99d556dfaa Binary files /dev/null and b/kogito-quarkus-examples/process-instance-migration-quarkus/docs/images/simple.png differ diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/pom.xml b/kogito-quarkus-examples/process-instance-migration-quarkus/pom.xml new file mode 100644 index 0000000000..d53a5a97f3 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/pom.xml @@ -0,0 +1,214 @@ + + + + 4.0.0 + + org.kie.kogito.examples + kogito-quarkus-examples + 999-SNAPSHOT + + process-instance-migration-quarkus + Kogito Example :: Process Instance Migration Quarkus + Process Instance Migration example - Quarkus + + 3.8.4 + quarkus-bom + io.quarkus + 3.8.4 + org.kie.kogito + kogito-bom + kogito-apps-bom + 999-SNAPSHOT + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + ${kogito.bom.group-id} + ${kogito.bom.artifact-id} + ${version.org.kie.kogito} + pom + import + + + ${kogito.bom.group-id} + ${kogito-apps.bom.artifact-id} + ${version.org.kie.kogito} + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-smallrye-health + + + + org.jbpm + jbpm-with-drools-quarkus + + + + org.jbpm + jbpm-quarkus + + + + org.kie + kie-addons-quarkus-process-management + + + org.kie + kogito-addons-quarkus-jobs-management + + + org.kie + kie-addons-quarkus-process-svg + + + org.kie + kie-addons-quarkus-source-files + + + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-agroal + + + org.kie + kie-addons-quarkus-persistence-jdbc + + + + + org.kie + kogito-addons-quarkus-data-index-persistence-postgresql + + + + + org.kie + kogito-addons-quarkus-jobs + + + org.kie.kogito + jobs-service-postgresql-common + + + + + org.kie + kogito-addons-quarkus-data-audit-jpa + + + org.kie + kogito-addons-quarkus-data-audit + + + + + container + + container + + + + io.quarkus + quarkus-container-image-jib + + + + + development + + dev + + + + + ${project.artifactId} + + + maven-compiler-plugin + ${version.compiler.plugin} + + ${maven.compiler.release} + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + build + + + + + + maven-failsafe-plugin + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + integration-test + verify + + + + + + + diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/migration-plan/addedtask_migration.mpf b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/migration-plan/addedtask_migration.mpf new file mode 100644 index 0000000000..bffd88c47a --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/migration-plan/addedtask_migration.mpf @@ -0,0 +1,19 @@ +{ + "name" : "simple to addedtask migration", + "processMigrationPlan" : { + "sourceProcessDefinition" : { + "processId" : "simple", + "processVersion" : "1.0" + }, + "targetProcessDefinition" : { + "processId" : "addedtask", + "processVersion" : "1.0" + }, + "nodeInstanceMigrationPlan" : [ + { + "sourceNodeId" : "_8430CA7E-8CC6-4C2C-9664-6B5BBD5E36CB", + "targetNodeId" : "_1D65864A-96AF-44FC-92CE-2073B9FBA7D0" + } + ] + } +} diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/addedtask-svg.svg b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/addedtask-svg.svg new file mode 100644 index 0000000000..309035339a --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/addedtask-svg.svg @@ -0,0 +1 @@ +log process creation log process continuationHT \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/modified-svg.svg b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/modified-svg.svg new file mode 100644 index 0000000000..e12a33db96 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/modified-svg.svg @@ -0,0 +1 @@ +log process creation log process continuationadded node \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/simple-svg.svg b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/simple-svg.svg new file mode 100644 index 0000000000..4b58627265 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/processSVG/simple-svg.svg @@ -0,0 +1 @@ +log process creation log process continuation \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/resources/index.html b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/resources/index.html new file mode 100644 index 0000000000..8556bab48e --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,150 @@ + + + + + + + + + + Kogito quickstart + + + + + + + + + + + + + + +
+
+
+
+

Welcome to Kogito

+

+ Cloud-native business automation for building intelligent applications, backed by + battle-tested capabilities. +

+ + Get Started + + + Latest updates + +
+
+
+
+
+
+
+

Quick Links

+ +
+
+
+ + + \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/addedtask.bpmn b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/addedtask.bpmn new file mode 100644 index 0000000000..67688a3787 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/addedtask.bpmn @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _D0E6CA53-1ECE-4F8D-AAF0-829B30A2719F + _2DFFEEA8-CA22-4076-A703-DB36A6471775 + + + + + + + + + _916690AE-8B09-4FA5-BF0D-8638E01A7472 + _D0E6CA53-1ECE-4F8D-AAF0-829B30A2719F + + + + + _74EA6719-7F99-48CD-A98E-17D422668B87_TaskNameInputX + _74EA6719-7F99-48CD-A98E-17D422668B87_SkippableInputX + + + + _74EA6719-7F99-48CD-A98E-17D422668B87_TaskNameInputX + + + + + + + _74EA6719-7F99-48CD-A98E-17D422668B87_SkippableInputX + + + + + + + + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + + + + + + + + _2DFFEEA8-CA22-4076-A703-DB36A6471775 + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + System.out.println("Ending process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + + + + + + _C7A1A566-057F-4A80-B654-61270F82F365 + _916690AE-8B09-4FA5-BF0D-8638E01A7472 + System.out.println("Started process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + _C7A1A566-057F-4A80-B654-61270F82F365 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _4YtTwNp2EDyug9043TBvzA + _4YtTwNp2EDyug9043TBvzA + + \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties new file mode 100644 index 0000000000..735e8aeaf3 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/application.properties @@ -0,0 +1,49 @@ +# Packaging +#quarkus.package.type=fast-jar + +#https://quarkus.io/guides/openapi-swaggerui +quarkus.http.cors=true +quarkus.smallrye-openapi.path=/docs/openapi.json +quarkus.swagger-ui.always-include=true +quarkus.kogito.data-index.graphql.ui.always-include=true +quarkus.http.test-port=0 + +# Kogito-service +kogito.service.url=http://localhost:8080 + +#Job-service +kogito.jobs-service.url=http://localhost:8080 + +# to be reachable from the container running job-service +kogito.dataindex.http.url=http://localhost:8180 +kogito.dataindex.ws.url=ws://localhost:8180 + +# run create tables scripts +quarkus.flyway.migrate-at-start=true +quarkus.flyway.baseline-on-migrate=true +quarkus.flyway.baseline-version=0.0 +quarkus.flyway.locations=classpath:/db/migration,classpath:/db/jobs-service,classpath:/db/data-audit/postgresql +quarkus.flyway.table=FLYWAY_RUNTIME_SERVICE + +kogito.persistence.type=jdbc +quarkus.datasource.db-kind=postgresql +%prod.quarkus.datasource.username=kogito-user +%prod.quarkus.datasource.password=kogito-pass +%prod.quarkus.datasource.jdbc.url=${QUARKUS_DATASOURCE_JDBC_URL:jdbc:postgresql://localhost:5432/kogito} +%prod.quarkus.datasource.reactive.url=${QUARKUS_DATASOURCE_REACTIVE_URL:postgresql://localhost:5432/kogito} + +quarkus.native.native-image-xmx=8g + +# profile to pack this example into a container, to use it execute activate the maven container profile, -Pcontainer +%container.quarkus.container-image.build=true +%container.quarkus.container-image.push=false +%container.quarkus.container-image.group=${USER} +%container.quarkus.container-image.registry=dev.local +%container.quarkus.container-image.tag=1.0-SNAPSHOT +%container.quarkus.container-image.name=kogito-process-instance-migration-service + +%dev.quarkus.kogito.devservices.enabled=true +%dev.kogito.users.jdoe.groups=admin,HR,IT + +# Disabling OIDC +quarkus.oidc.enabled=false \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/modified.bpmn b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/modified.bpmn new file mode 100644 index 0000000000..530941a900 --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/modified.bpmn @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _C9EA1F49-3940-4EBF-9493-7D36839FCD16 + _B7675247-EA61-4BFC-9103-1AFF3E8E25ED + System.out.println("Executing added node"); + + + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + + + + + + + + _B7675247-EA61-4BFC-9103-1AFF3E8E25ED + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + System.out.println("Ending process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + _D77BDF48-2A9F-4032-9BE5-AC111F59EE88 + _C9EA1F49-3940-4EBF-9493-7D36839FCD16 + + + + + + + + + _C7A1A566-057F-4A80-B654-61270F82F365 + _D77BDF48-2A9F-4032-9BE5-AC111F59EE88 + System.out.println("Started process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + _C7A1A566-057F-4A80-B654-61270F82F365 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hNupoNpwEDyMua5P8aJUyQ + _hNupoNpwEDyMua5P8aJUyQ + + \ No newline at end of file diff --git a/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/simple.bpmn b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/simple.bpmn new file mode 100644 index 0000000000..685f2afb7b --- /dev/null +++ b/kogito-quarkus-examples/process-instance-migration-quarkus/src/main/resources/simple.bpmn @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + + + + + + + + _7B3EEFD3-98FD-4AF7-9038-E66015F565B9 + _FA3E1FF8-4894-47DA-90EB-DAB27BD7E925 + System.out.println("Ending process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + _D77BDF48-2A9F-4032-9BE5-AC111F59EE88 + _7B3EEFD3-98FD-4AF7-9038-E66015F565B9 + + + + + + + + + _C7A1A566-057F-4A80-B654-61270F82F365 + _D77BDF48-2A9F-4032-9BE5-AC111F59EE88 + System.out.println("Started process " + kcontext.getProcessInstance().getId() + " [" + kcontext.getProcessInstance().getProcessName() + ", v" + kcontext.getProcessInstance().getProcessVersion() + "]"); + + + _C7A1A566-057F-4A80-B654-61270F82F365 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _hNcVwNpwEDykP42egfgpsw + _hNcVwNpwEDykP42egfgpsw + + \ No newline at end of file