-
1. Re: How to invoke a deployed business process
brado May 23, 2006 3:33 PM (in response to brado)Can anyone help me with this? What is the proper way to invoke a business process deployed in JBoss from Java code (like a servlet).
Thanks. -
2. Re: How to invoke a deployed business process
kbarfield May 23, 2006 4:02 PM (in response to brado)There is a full API for interacting with jBPM from Java code. Please take a look at the sample web app that comes with jBPM. It is Java code calling processes that have been deployed to jBPM. This code fragment example is from the HomeBean.java in jbpm-starters-kit-3.1\jbpm\src\java.webapp\org\jbpm\webapp\bean
/** * prepares a task form for starting a new process instance. */ public String startProcessInstance() { // Get the task instance id from request parameter long processDefinitionId = JsfHelper.getId("processDefinitionId"); ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId); // create a new process instance to run ProcessInstance processInstance = new ProcessInstance(processDefinition); // create a new taskinstance for the start task TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance(); // Save the process instance along with the task instance jbpmContext.save(processInstance); // Fill the task backing bean with useful information taskBean.initialize(taskInstance); return "task"; }
-
3. Re: How to invoke a deployed business process
tomdom Aug 1, 2006 10:22 AM (in response to brado)I'm a JBoss newbie and let me assure myself. Cause I agree with Brado it is not clearly stated, I think :-)
If I write, say, a session bean that uses objects and methods like those in the HomeBean class, wil it work? Will these methods in the deployed session bean find eg process instances deployed on the server?
Best regards,
Thomas -
4. Re: How to invoke a deployed business process
kukeltje Aug 1, 2006 10:34 AM (in response to brado)why wouldn't they? The thing you have to look out for is to have a JbpmContext. In the webapp that is done automagically.