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 Copy linkLink copied to clipboard!
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.zipfile from the Software Downloads page for Red Hat Process Automation Manager 7.13. -
Extract the
rhpam-7.13.5-add-ons.zipfile. -
Extract the
rhpam-7.13.5-process-migration-service.zipfile. 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
$ 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.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Change directory to the
process-migrationdirectory. Use a text editor to create the
servers.yamlconfiguration file with the following content and save in theprocess-migrationdirectory. 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>kieservers: - host: http://localhost:8080/kie-server/services/rest/server username: <user_name> password: <password>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use a text editor to create the
datasource.yamlconfiguration file with the following contentdatasource.yamland save in theprocess-migrationdirectory. In this example, replace<user_name>and<password>with the credentials to log in to the database:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rebuild the
quarkus-run.jarfile to include the PostgreSQL driver:java -jar -Dquarkus.launch.rebuild=true -Dquarkus.datasource.db-kind=postgresql quarkus-app/quarkus-run.jar
$ java -jar -Dquarkus.launch.rebuild=true -Dquarkus.datasource.db-kind=postgresql quarkus-app/quarkus-run.jarCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output of this command should be similar to the following example:
INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 2657ms
INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 2657msCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
quarkus-appJAR file:java -jar -Dquarkus.http.port=8090 -Dquarkus.config.locations=servers.yaml,datasource.yaml quarkus-app/quarkus-run.jar
$ java -jar -Dquarkus.http.port=8090 -Dquarkus.config.locations=servers.yaml,datasource.yaml quarkus-app/quarkus-run.jarCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command returns output similar to the following example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
To access the Process Instance Migration application, enter
http://localhost:8090/in a web browser . -
When prompted, enter the user name
adminand the passwordadmin1!. The Process Instance Migration console appears.
32.2. Using Keystore Vault Copy linkLink copied to clipboard!
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
keytoolcommand. 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
$ 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 PKCS12Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the PIM Keystore Vault to use the keystore file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure your application to use the credentials from the vault. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
VAULT_STOREPASSWORD=mysecret java -jar quarkus-app/quarkus-run.jarCopy to Clipboard Copied! Toggle word wrap Toggle overflow As a system property:
java -Dvault.storepassword=password -jar quarkus-app/quarkus-run.jar
java -Dvault.storepassword=password -jar quarkus-app/quarkus-run.jarCopy to Clipboard Copied! Toggle word wrap Toggle overflow
32.3. Creating a migration plan Copy linkLink copied to clipboard!
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:8080in 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
JSONfile, click Export. - In the Review & Submit tab, review the plan and click Submit Plan.
-
Optional: To export as a
JSONfile, click Export. - Review the response and click Close.
32.4. Editing a migration plan Copy linkLink copied to clipboard!
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:8080in 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
JSONfile, click Export. - In the Review & Submit tab, review the plan and click Submit Plan.
-
Optional: To export as a
JSONfile, click Export. - Review the response and click Close.
32.5. Exporting a migration plan Copy linkLink copied to clipboard!
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:8080in 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 Copy linkLink copied to clipboard!
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:8080in 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
JSONfile, click Export. - Click Execute Plan.
-
Optional: To export as a
JSONfile, click Export. - Check the response and click Close.
32.7. Deleting a migration plan Copy linkLink copied to clipboard!
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:8080in 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.