How to invoke a JBPM process from a Servlet/JSP page? All the examples talks about the API, but the example expecting is where to mention the HOST, PORT , and the PATH to connect the JBPM Flow?
However If there are two developers one is working on JBPM5 process and deploys to server A. and nother developer is working on Web application he deploys his web application on server B?
Now how to submit the request (or invokes the JBPM Process) from server B ?
The steps are:
1. Build your Process in Eclipse.
2. Register this process with Drools repository (see how to do it in the Chapter 16 http://docs.jboss.org/jbpm/v5.3/userguide/ch.process-repository.html ).
(Right click on your Evaluation.bpmn process choose Guvnor and then add (provide the host and port and authentication credentials.)
3. Now you can browse the to see your deployed process at bpmn-console http://localhost:8080/jbpm-console/
4. Also you can see the same process in the govnor http://localhost:8080/drools-guvnor
5. Invoke the process from the Web application Copy all the process in some folder say html-public/jbpmflows/ (you can copy all others flows here)
6. Use the following code with the URL that you can point to the process file as a simple static file
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
//kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);
//kbuilder.add(ResourceFactory.newUrlResource("file:///D:/Evaluation.bpmn"), ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newUrlResource(new java.net.URL("http://:8080/webcontextroot/jbpm/Evaluation.bpmn ")), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
7. submit your flow request to the host system where your flows were registered
private static StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase) {
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
HornetQHTWorkItemHandler humanTaskHandler = new HornetQHTWorkItemHandler(ksession);
humanTaskHandler.setIpAddress("127.0.0.1"); //govnor host
humanTaskHandler.setPort(5445); //govnor port
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);
return ksession;
}
--More details are welcome.
No comments:
Post a Comment