JBPM 6 Jbpm-Console does not display processes started from external service
jjxman Mar 9, 2014 11:05 PMLooking for help on anyone who has faced the same problem I have with JBPM 6 Console.
Problems statement;
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.
Problem
- ) If you've clicked on a Process Model deployed through KIE, then clicking on Process Models of Processes from external services shows the previous opened Process Model. Or even wrong Process models for the external Services,
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.
Observations :
I've noticed that the JBPM-CONSOLE looks for Definition Name which is externalId in JBPM database for ProcessInstanceLog, NodeInstanceLog & VariableInstanceLog.
for workflows which is executed through KIE console, the DefinitionName / externalId is the id of groupId:ArtifactId:version and if I patch externalId to the id required, the Process Model can be viewed. However, by default, DefinitionName / externalId is a running number if started from an external service.
I have Googled quite extensively, but there doesn't seem to have any examples out there how to set the externalId via code. Maybe I'm googling wrongly.
Or is this a bug from the JBPM-Console? Since the externalId is already created, why does it need to match that in deployment from Kie Console ?
Any help from all you jbpm users out there?
What could I be doing wrong?
Noob in JBPM and thanks in advance.
Environment : Jboss 7.1.1, jbpm6 as per installed using Ant install.demo for JBPM6.0.0.Final