Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 32. Process instance migration

download PDF

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

  1. Download the rhpam-7.13.5-add-ons.zip file from the Software Downloads page for Red Hat Process Automation Manager 7.13.
  2. Extract the rhpam-7.13.5-add-ons.zip file.
  3. Extract the rhpam-7.13.5-process-migration-service.zip file.
  4. 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
  5. Change directory to the process-migration directory.
  6. Use a text editor to create the servers.yaml configuration file with the following content and save in the process-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>
  7. Use a text editor to create the datasource.yaml configuration file with the following content datasource.yaml and save in the process-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>
  8. 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
  9. 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]
  10. To access the Process Instance Migration application, enter http://localhost:8090/ in a web browser .
  11. When prompted, enter the user name admin and the password admin1!. 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.

Note

You can only use database and KIE Server related credentials for PIM configurations.

Procedure

  1. 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
  2. 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
  3. 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
  4. 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

  1. Enter http://localhost:8080 in a web browser.
  2. Log in to the PIM service.
  3. 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.
  4. Click Add Plan. The Add Migration Plan Wizard window opens.
  5. In the Name field, enter a name for the migration plan.
  6. Optional: In the Description field, enter a description for the migration plan.
  7. Click Next.
  8. In the Source ContainerID field, enter the source container ID.
  9. In the Source ProcessId field, enter the source process ID.
  10. Click Copy Source To Target.
  11. In the Target ContainerID field, update the target container ID.
  12. Click Retrieve Definition from backend and click Next.

    pim migration wizard
  13. From the Source Nodes list, select the source node you want to map.
  14. From the Target Nodes list, select the target node you want to map.
  15. If the Source Process Definition Diagram pane is not displayed, click Show Source Diagram.
  16. If the Target Process Definition Diagram pane is not displayed, click Show Target Diagram.
  17. Optional: To modify the view in the diagram panes, perform any of the following tasks:

    • To select text, select the pim selection icon icon.
    • To pan, select the pim pan icon icon.
    • To zoom in, select the pim zoom in icon icon.
    • To zoom out, select the pim zoom out icon icon.
    • To fit to viewer, select the pim fit to icon icon.
  18. Click Map these two nodes.
  19. Click Next.
  20. Optional: To export as a JSON file, click Export.
  21. In the Review & Submit tab, review the plan and click Submit Plan.
  22. Optional: To export as a JSON file, click Export.
  23. 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

  1. Enter http://localhost:8080 in a web browser.
  2. Log in to the PIM service.
  3. On the Process Instance Migration page, select the Edit Migration Plan pim edit icon icon on the row of the migration plan you want to edit. The Edit Migration Plan window opens.
  4. On each tab, modify the details you want to change.
  5. Click Next.
  6. Optional: To export as a JSON file, click Export.
  7. In the Review & Submit tab, review the plan and click Submit Plan.
  8. Optional: To export as a JSON file, click Export.
  9. 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

  1. Enter http://localhost:8080 in a web browser.
  2. Log in to the PIM service.
  3. On the Process Instance Migration page, select the Export Migration Plan pim export icon icon on the row of the migration plan you want to execute. The Export Migration Plan window opens.
  4. 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

  1. Enter http://localhost:8080 in a web browser.
  2. Log in to the PIM service.
  3. On the Process Instance Migration page, select the Execute Migration Plan pim execute icon icon on the row of the migration plan you want to execute. The Execute Migration Plan Wizard window opens.
  4. From the migration plan table, select the check box on the row of each running process instance you want to migrate, and click Next.
  5. In the Callback URL field, enter the callback URL.
  6. 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.
  7. Click Next.
  8. Optional: To export as a JSON file, click Export.
  9. Click Execute Plan.
  10. Optional: To export as a JSON file, click Export.
  11. 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

  1. Enter http://localhost:8080 in a web browser.
  2. Log in to the PIM service.
  3. On the Process Instance Migration page, select the Delete pim delete icon icon on the row of the migration plan you want to delete. The Delete Migration Plan window opens.
  4. Click Delete to confirm deletion.
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.