This content has been marked as final.
Show 3 replies
-
1. Re: How to start a jbpm process asynchronously
lvdberg Apr 25, 2010 7:25 PM (in response to balazska)Hi Kim,
Use the raise asynchronous event in your bean and let the observing class start the processes. Works like a charm,
Leo
-
2. Re: How to start a jbpm process asynchronously
balazska Apr 26, 2010 10:05 AM (in response to balazska)It does not work.
I think the jbpm process start should start with an available conversation, but raiseAsyncEvent works with request scope.
-
3. Re: How to start a jbpm process asynchronously
lvdberg Apr 26, 2010 11:33 AM (in response to balazska)Hi,
I had the same problems in a combined EJB3/POJO environment. I stopped using the JBPM annotation because it gave too much problems. I directly use the JBPM api:
As an example:
@Observer("es.esam.im4u.trafficIncidentEvent.startTask") public void startIncidentManagement(TrafficIncident i, String actor) { // Prepare the stuff and get the vars you need from the Async call try { GraphSession gs = jbpmContext.getGraphSession(); ProcessDefinition def = gs.findLatestProcessDefinition("incidentManagement"); // Put all the vars you need in the pi-vars // Create a new ProcessInstance ProcessInstance pi = new ProcessInstance(def); pi.getContextInstance().createVariable("location", location); // Place the token right after the start node Token tkn = pi.getRootToken(); tkn.signal(); jbpmContext.save(pi); } catch (Exception e){ log.error(e.getMessage()); } }