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

JBPM-Console KIE does not display Process Model if externalId in Persistence Table is not GAV

    Details

    • Steps to Reproduce:
      Hide

      Environment setup of jbpm6.0.0.Final full installer via ant install.demo

      I've one simple BPMN file, both build & deployed via Kie.

      • ) the workflow was designed in Eclipse. pushed to Kie via Git.

      In KIE

      • ) Workflow is viewable and correct with Authoring -> Project Authoring.
      • ) Workflow built and deployed.
      • ) Process Definition lists the workflow, upon starting the process, the Instance gets shown in Process Instance List.
      • ) Clicking on Views -> Process Models views the path which the workflow has executed.

      Project Instance deployed with external services.

      • ) Workflow is built and deployed as in KIE, similar Workflow
      • ) Process Definition lists the workflow, upon starting the process, the Instance gets shown in Process Instance List.
      • ) Clicking on Views -> Process Models DOES NOT SHOW THE MODEL.

      External Service Code;
      Below is my sample of my external Service code to the exact dot.
      try

      { // create the entity manager factory and register it in the environment EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.domain" ); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.newKieContainer(ks.newReleaseId("groupId", "ArtifactId", "1.0.0")); //create a new knowledge session that uses JPA to store the runtime state org.kie.api.KieBase kbase = kContainer.newKieSession("defaultKieSession").getKieBase(); StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase , null, env ); //for persistence.. //persistence logger JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession); //local variables only for the workflow that is called Map<String, Object> params = new HashMap<String, Object>(); ksession.setGlobal("WORKFLOW_PROCESS","someWorkflowProcessIdentifiyForMySelf"); ksession.startProcess("WorkflowProcessName",params); }

      catch (Exception e)

      { // TODO Auto-generated catch block e.printStackTrace(); }

      My Persistence.xml is same as that deployed with jbpm-console.

      1) Create a Process Instance from Jbpm-Console. Process Instance Model will Show
      2) Create a Process Instance from external code, having ksession set the externalId with processInstanceId. Process Instance Model will NOT show.
      3) Patch externalId of the Process Instances in the Persistence Tables with GAV, Process Instane Model will show.

      Show
      Environment setup of jbpm6.0.0.Final full installer via ant install.demo I've one simple BPMN file, both build & deployed via Kie. ) the workflow was designed in Eclipse. pushed to Kie via Git. In KIE ) Workflow is viewable and correct with Authoring -> Project Authoring. ) Workflow built and deployed. ) Process Definition lists the workflow, upon starting the process, the Instance gets shown in Process Instance List. ) Clicking on Views -> Process Models views the path which the workflow has executed. Project Instance deployed with external services. ) Workflow is built and deployed as in KIE, similar Workflow ) Process Definition lists the workflow, upon starting the process, the Instance gets shown in Process Instance List. ) Clicking on Views -> Process Models DOES NOT SHOW THE MODEL. External Service Code; Below is my sample of my external Service code to the exact dot. try { // create the entity manager factory and register it in the environment EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.domain" ); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.newKieContainer(ks.newReleaseId("groupId", "ArtifactId", "1.0.0")); //create a new knowledge session that uses JPA to store the runtime state org.kie.api.KieBase kbase = kContainer.newKieSession("defaultKieSession").getKieBase(); StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase , null, env ); //for persistence.. //persistence logger JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession); //local variables only for the workflow that is called Map<String, Object> params = new HashMap<String, Object>(); ksession.setGlobal("WORKFLOW_PROCESS","someWorkflowProcessIdentifiyForMySelf"); ksession.startProcess("WorkflowProcessName",params); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } My Persistence.xml is same as that deployed with jbpm-console. 1) Create a Process Instance from Jbpm-Console. Process Instance Model will Show 2) Create a Process Instance from external code, having ksession set the externalId with processInstanceId. Process Instance Model will NOT show. 3) Patch externalId of the Process Instances in the Persistence Tables with GAV, Process Instane Model will show.

      Description

      Referring to community problem discussion
      https://community.jboss.org/message/863029

      Summary
      The Jbpm-console / KIE does not show the Process Model if the display if the externalId in the Persistence Tables (PersistenceInstanceLog, NodeInstanceLog, VariableInstanceLog) is not the GAV but rather the unique processInstanceId provided by ksession.

      Observations

      • ) If clicked on a Process Model deployed through Jbpm-Console / KIE, then clicking on Process Models of Processes Instances created from external services shows the previous opened Process Model of Process Instances created from that internally by Jbpm-Console / Kie. Or even wrong Process models for the Process Instances created from the external Services.
      • ) Process Models will show IF "externalId" in Persistence Tables are that of GAV (Group, Artifact, Version) . This in Jbpm-console / KIE is displayed as DeployementId for the Process Instance Model, Process instance.

      -) Process Models will NOT show IF "externalId" in Persistence Tables is that provided by ksession.getProcessInstance().getId() [ unique ] from external execution (non jbpm-console). Process Instance IS Listed but NOT Process Instance Model. Observation DeploymentId is NOT GAV.

      -) Seems that for the Process Model to display, the externalId has to be the GAV. Observation is that patching Unique externalId provided by ksession with GAV will have the Process Instance Model view.

      Problem Statement.
      This is non ideal as the (unique) externalId provided from ksession is required for event processing. In the real world where there might be hundreds to thousands of Process Instances initiated, if the externalId is that of GAV, rather than the specific unique process instance id provided by ksession is event triggered to continue, the whole system will be scanned to continue which will definately cause a problem.
      Also, based on documentation on event handling, this is an inconsistency in what is documented on Process Initiation and also Event Handling.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swiderski.maciej Maciej Swiderski
                Reporter:
                jjxman Joey Teo
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: