Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-9654

Migration of all subprocess of a parent process fails

    XMLWordPrintable

Details

    Description

      When testing the new functionality as part of BAPL-1858, I've come across an issue making unable to migrate a particular parent instance containing subprocess.

      For instance, let's say we have the following:

      • Parent process named "parent1"
      • Subprocess named "subprocess"
      • containerId "definition-project"

      Now if we wanted to migrate that parent to a different container named "definition-project2", with a new process definition named "parent2", we would be be calling processMigrationService something like:

      processAdminClient.migrateProcessInstanceWithSubprocess("definition-project", processParentInstanceId, "definition-project", "parent2");
      

       

      Problem is that we are internally calling an existing method to migrate a list of process instances

      public MigrationReportInstanceList migrateProcessInstanceWithAllSubprocess(String containerId, Long processInstanceId, String targetContainerId, String targetProcessId, String payload, String marshallingType) {
              
        ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);        
        if(pi.getParentId() > 0) {            
          throw new IllegalArgumentException("Only root process can invoke this migration with all subprocesses");        
        }
              
        List<Long> processInstancesId = runtimeDataService.getProcessInstancesWithSubprocessByProcessInstanceId(processInstanceId,                                               singletonList(ProcessInstance.STATE_ACTIVE), new QueryContext(0,   -1)).stream().map(ProcessInstanceDesc::getId).collect(Collectors.toList());
      
        return migrateProcessInstances(containerId, processInstancesId, targetContainerId, targetProcessId, payload, marshallingType);    
      }

       

      So basically, if you see, "targetProcessId" is passed as parameter to the method which actually belongs to the parent process and not to the child. Therefore, the migration service will fail afterwards because the node does not exist in the new parent target process we have just passed:

      [INFO] [talledLocalContainer] 13:38:31,366 ERROR [org.jbpm.runtime.manager.impl.migration.MigrationManager] (Thread-3 (ActiveMQ-client-global-threads)) Unexpected error during migration: org.jbpm.runtime.manager.impl.migration.MigrationException: Node with id _43CFB5DA-5BEB-40A7-811B-E656C6EB07A0 was not found in new process definition
      

        

      To reproduce this, just clone following PR

      https://github.com/kiegroup/droolsjbpm-integration/pull/2423

      And run the following maven command under the "droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-jbpm" folder (test case is testUpgradeParentInstanceWithIndependentSubprocess).

      mvn -Pwildfly -Dit.test=ProcessInstanceMigrationIntegrationTest verify
      

       

      Attachments

        Activity

          People

            elguardian@gmail.com Enrique González Martínez (Inactive)
            antferna Antonio Fernandez Alhambra (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: