Chapter 6. Process instance migration
Process instance migration (PIM) is a standalone service containing a user interface and a back-end. It is packaged as a Thorntail uber-JAR. 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 ).
6.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 backup-ed Red Hat Process Automation Manager development environment.
Procedure
-
Download the
rhpam-7.8.0-add-ons.zip
file from the Software Downloads page for Red Hat Process Automation Manager 7.8. - Unzip the downloaded archive.
-
Move the
rhpam-7.8.0-process-migration-service-standalone.jar
file from the add-ons archive to a desired location. In the location, create a YAML file containing the kieserver and Thorntail configuration, for example:
thorntail: deployment: process-migration.war: jaxrs: application-path: /rest web: login-config: auth-method: BASIC security-domain: pim security-constraints: - url-pattern: /* roles: [ admin ] - url-pattern: /health/* datasources: data-sources: pimDS: driver-name: h2 connection-url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE user-name: DS_USERNAME password: DS_PASSWORD security: security-domains: pim: classic-authentication: login-modules: UsersRoles: code: UsersRoles flag: required module-options: usersProperties: application-users.properties rolesProperties: application-roles.properties kieservers: - host: http://localhost:8080/kie-server/services/rest/server username: KIESERVER_USERNAME password: KIESERVER_PASSWORD - host: http://localhost:8280/kie-server/services/rest/server username: KIESERVER_USERNAME password: KIESERVER_PASSWORD1
Start the PIM service:
$ java -jar rhpam-7.8.0-process-migration-service-standalone.jar -s./config.yml
To enable auto-detection of a JDBC driver by Thorntail, add the
JAR
file of the JDBC driver name to thethorntail.classpath
system property. For example:$ java -Dthorntail.classpath=./h2-1.4.200.jar -jar rhpam-7.8.0-process-migration-service-standalone.jar -s ./config.yml
NoteThe
h2
JDBC driver is included by default. You can use different JDBC drivers to connect to different external databases.-
After the PIM service is up and running, enter
http://localhost:8080
in a web browser.
6.2. 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 backup-ed 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.
- 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.
6.3. 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 backup-ed 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.
6.4. 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 backup-ed 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.
6.5. 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 backup-ed 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.
6.6. 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 backup-ed 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.