Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 32. Process instance migration
Process instance migration (PIM) is a standalone service containing a user interface and a back-end. It is packaged as a Quarkus mutable JAR file. You can use the PIM service to define the migration between two different process definitions, known as a migration plan. The user can then apply the migration plan to the running process instance in a specific KIE Server.
For more information about the PIM service, see Process Instance Migration Service in KIE (Drools, OptaPlanner and jBPM ).
32.1. Installing the process instance migration service
You can use the process instance migration (PIM) service to create, export and execute migration plans. The PIM service is provided through a GitHub repository. To install the PIM service, clone the GitHub repository, then run the service and access it in a web browser.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- Java Runtime Environment (JRE) version 11 or later is installed.
Procedure
-
Download the
rhpam-7.13.5-add-ons.zip
file from the Software Downloads page for Red Hat Process Automation Manager 7.13. -
Extract the
rhpam-7.13.5-add-ons.zip
file. -
Extract the
rhpam-7.13.5-process-migration-service.zip
file. Enter the following commands to create the database tables. Replace
<user>
with your user name and<host>
with the name of the local host:$ psql -U <user> -h <host> -d rhpam7 -f ~/process-migration/ddl-scripts/postgres/postgresql-quartz-schema.sql $ psql -U <user> -h <host> -d rhpam7 -f ~/process-migration/ddl-scripts/postgres/postgresql-pim-schema.sql
-
Change directory to the
process-migration
directory. Use a text editor to create the
servers.yaml
configuration file with the following content and save in theprocess-migration
directory. In this example, replace<user_name>
and<password>
with the credentials to log in to the KieServer.kieservers: - host: http://localhost:8080/kie-server/services/rest/server username: <user_name> password: <password>
Use a text editor to create the
datasource.yaml
configuration file with the following contentdatasource.yaml
and save in theprocess-migration
directory. In this example, replace<user_name>
and<password>
with the credentials to log in to the database:quarkus: datasource: db-kind: postgresql jdbc: url: jdbc:postgresql://localhost:5432/rhpam7 username: <user_name> password: <password>
Rebuild the
quarkus-run.jar
file to include the PostgreSQL driver:$ java -jar -Dquarkus.launch.rebuild=true -Dquarkus.datasource.db-kind=postgresql quarkus-app/quarkus-run.jar
The output of this command should be similar to the following example:
INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 2657ms
Run the
quarkus-app
JAR file:$ java -jar -Dquarkus.http.port=8090 -Dquarkus.config.locations=servers.yaml,datasource.yaml quarkus-app/quarkus-run.jar
This command returns output similar to the following example:
__ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \ --\___\_\____/_/ |_/_/|_/_/|_|\____/___/ 2022-03-11 13:04:18,261 INFO [org.fly.cor.int.lic.VersionPrinter] (main) Flyway Community Edition 7.14.0 by Redgate 2022-03-11 13:04:18,262 INFO [org.fly.cor.int.dat.bas.BaseDatabaseType] (main) Database: jdbc:postgresql://localhost:5432/rhpam7 (PostgreSQL 13.4) 2022-03-11 13:04:18,280 INFO [org.fly.cor.int.com.DbMigrate] (main) Current version of schema "public": 1.0 2022-03-11 13:04:18,281 INFO [org.fly.cor.int.com.DbMigrate] (main) Schema "public" is up to date. No migration necessary. 2022-03-11 13:04:18,601 INFO [org.qua.imp.jdb.JobStoreCMT] (main) Freed 0 triggers from 'acquired' / 'blocked' state. 2022-03-11 13:04:18,603 INFO [org.qua.imp.jdb.JobStoreCMT] (main) Recovering 0 jobs that were in-progress at the time of the last shut-down. 2022-03-11 13:04:18,603 INFO [org.qua.imp.jdb.JobStoreCMT] (main) Recovery complete. 2022-03-11 13:04:18,603 INFO [org.qua.imp.jdb.JobStoreCMT] (main) Removed 0 'complete' triggers. 2022-03-11 13:04:18,603 INFO [org.qua.imp.jdb.JobStoreCMT] (main) Removed 0 stale fired job entries. 2022-03-11 13:04:18,624 INFO [org.kie.ser.api.mar.MarshallerFactory] (main) Marshaller extensions init 2022-03-11 13:04:18,710 INFO [org.kie.pro.ser.imp.KieServiceImpl] (main) Loaded kie server configuration for: org.kie.processmigration.model.config.KieServers$KieServer9579928Impl@4b6b5352 2022-03-11 13:04:18,715 INFO [org.kie.pro.ser.RecoveryService] (main) Resuming ongoing migrations ... 2022-03-11 13:04:18,856 INFO [io.quarkus] (main) process-migration-service 7.59.0.Final-redhat-00006 on JVM (powered by Quarkus 2.2.3.Final-redhat-00013) started in 1.443s. Listening on: http://0.0.0.0:8090 2022-03-11 13:04:18,857 INFO [io.quarkus] (main) Profile prod activated. 2022-03-11 13:04:18,857 INFO [io.quarkus] (main) Installed features: [agroal, cdi, config-yaml, flyway, hibernate-orm, hibernate-orm-panache, jdbc-db2, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, narayana-jta, quartz, resteasy, resteasy-jackson, scheduler, security, security-jdbc, security-ldap, security-properties-file, smallrye-context-propagation, smallrye-health]
-
To access the Process Instance Migration application, enter
http://localhost:8090/
in a web browser . -
When prompted, enter the user name
admin
and the passwordadmin1!
. The Process Instance Migration console appears.
32.2. Using Keystore Vault
You can use the Quarkiverse File Vault extension to store credentials as keystore files and use the file
method to use the keystore files with the Process Instance Migration (PIM) Keystore Vault. For more information about the Quarkiverse File Vault extension, see Quarkiverse File Vault. For more information about using the KeyStore Vault, see Using Keystore Vault on GitHub. For more information about credentials provision, see the Credentials Provider section in the Quarkus documentation.
You can only use database and KIE Server related credentials for PIM configurations.
Procedure
To add passwords to anew or existing keystore file for the PIM Keystore Vault, use the
keytool
command. For example:$ keytool -importpass -alias pimdb -keystore pimvault.p12 -storepass password -storetype PKCS12 $ keytool -importpass -alias kieserver -keystore pimvault.p12 -storepass password -storetype PKCS12 $ keytool -importpass -alias cert -keystore pimvault.p12 -storepass password -storetype PKCS12 $ keytool -importpass -alias keystore -keystore pimvault.p12 -storepass password -storetype PKCS12 $ keytool -importpass -alias truststore -keystore pimvault.p12 -storepass password -storetype PKCS12
Configure the PIM Keystore Vault to use the keystore file. For example:
quarkus: file: vault: provider: pim: path: pimvault.p12 secret: ${vault.storepassword} # This will be provided as a property
Configure your application to use the credentials from the vault. For example:
quarkus: datasource: credentials-provider: quarkus.file.vault.provider.pim.pimdb kieservers: - host: http://localhost:18080/kie-server/services/rest/server credentials-provider: quarkus.file.vault.provider.pim.kieserver
To start PIM with the configured credentials, specify the credentials as an environment variable or as a system property. For example:
As an environment variable:
VAULT_STOREPASSWORD=mysecret java -jar quarkus-app/quarkus-run.jar
As a system property:
java -Dvault.storepassword=password -jar quarkus-app/quarkus-run.jar
32.3. Creating a migration plan
You can define the migration between two different process definitions, known as a migration plan, in the process instance migration (PIM) service web UI.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- The process instance migration service is running.
Procedure
-
Enter
http://localhost:8080
in a web browser. - Log in to the PIM service.
- In the upper right corner of the Process Instance Migration page, from the KIE Service list select the KIE Service you want to add a migration plan for.
- Click Add Plan. The Add Migration Plan Wizard window opens.
- In the Name field, enter a name for the migration plan.
- Optional: In the Description field, enter a description for the migration plan.
- Click Next.
- In the Source ContainerID field, enter the source container ID.
- In the Source ProcessId field, enter the source process ID.
- Click Copy Source To Target.
- In the Target ContainerID field, update the target container ID.
Click Retrieve Definition from backend and click Next.
- From the Source Nodes list, select the source node you want to map.
- From the Target Nodes list, select the target node you want to map.
- If the Source Process Definition Diagram pane is not displayed, click Show Source Diagram.
- If the Target Process Definition Diagram pane is not displayed, click Show Target Diagram.
Optional: To modify the view in the diagram panes, perform any of the following tasks:
-
To select text, select the
icon.
-
To pan, select the
icon.
-
To zoom in, select the
icon.
-
To zoom out, select the
icon.
-
To fit to viewer, select the
icon.
-
To select text, select the
- Click Map these two nodes.
- Click Next.
-
Optional: To export as a
JSON
file, click Export. - In the Review & Submit tab, review the plan and click Submit Plan.
-
Optional: To export as a
JSON
file, click Export. - Review the response and click Close.
32.4. Editing a migration plan
You can edit a migration plan in the process instance migration (PIM) service web UI. You can modify the migration plan name, description, specified nodes, and process instances.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- The PIM service is running.
Procedure
-
Enter
http://localhost:8080
in a web browser. - Log in to the PIM service.
-
On the Process Instance Migration page, select the Edit Migration Plan
icon on the row of the migration plan you want to edit. The Edit Migration Plan window opens.
- On each tab, modify the details you want to change.
- Click Next.
-
Optional: To export as a
JSON
file, click Export. - In the Review & Submit tab, review the plan and click Submit Plan.
-
Optional: To export as a
JSON
file, click Export. - Review the response and click Close.
32.5. Exporting a migration plan
You can export migration plans as a JSON file using the process instance migration (PIM) service web UI.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- The PIM service is running.
Procedure
-
Enter
http://localhost:8080
in a web browser. - Log in to the PIM service.
-
On the Process Instance Migration page, select the Export Migration Plan
icon on the row of the migration plan you want to execute. The Export Migration Plan window opens.
- Review and click Export.
32.6. Executing a migration plan
You can execute the migration plan in the process instance migration (PIM) service web UI.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- The PIM service is running.
Procedure
-
Enter
http://localhost:8080
in a web browser. - Log in to the PIM service.
-
On the Process Instance Migration page, select the Execute Migration Plan
icon on the row of the migration plan you want to execute. The Execute Migration Plan Wizard window opens.
- From the migration plan table, select the check box on the row of each running process instance you want to migrate, and click Next.
- In the Callback URL field, enter the callback URL.
To the right of Run migration, perform one of the following tasks:
- To execute the migration immediately, select Now.
-
To schedule the migration, select Schedule and in the text field, enter the date and time, for example
06/20/2019 10:00 PM
.
- Click Next.
-
Optional: To export as a
JSON
file, click Export. - Click Execute Plan.
-
Optional: To export as a
JSON
file, click Export. - Check the response and click Close.
32.7. Deleting a migration plan
You can delete a migration plan in the process instance migration (PIM) service web UI.
Prerequisites
- You have defined processes in a backed up Red Hat Process Automation Manager development environment.
- The PIM service is running.
Procedure
-
Enter
http://localhost:8080
in a web browser. - Log in to the PIM service.
-
On the Process Instance Migration page, select the Delete
icon on the row of the migration plan you want to delete. The Delete Migration Plan window opens.
- Click Delete to confirm deletion.