This content has been marked as final.
Show 4 replies
-
1. Re: BPEL Process Instance
aguizar Feb 1, 2006 6:42 PM (in response to adrian.andrei)Yes, there is. If you take a look at the console logs, you will notice the events of the underlying jBPM graph. Right now there is no declarative way to capture them, but you can do it programatically.
After you deploy the process archive, but before you deploy the web services, load the process definition, perform the following operations, and save it back.// register the action we want executed at the end Action endAction = new Action(); endAction.setName("endAction"); processDefinition.addAction(endAction); // delegate the action's execution to a handler Delegation endDelegation = new Delegation(); endDelegation.setClassName(EndHandler.class.getName()); endAction.setActionDelegation(endDelegation); // register an event of type process end Event event = new Event(Event.EVENTTYPE_PROCESS_END); processDefinition.addEvent(event); // associate the above action with the event event.addAction(endAction);
As a reference, the EndHandler is:public class EndHandler implements ActionHandler { private static final long serialVersionUID = 1L; public void execute(ExecutionContext exeContext) throws Exception { [...] } }
-
2. Re: BPEL Process Instance
adrian.andrei Feb 3, 2006 10:12 AM (in response to adrian.andrei)Thanks for your response, nice.
Just a note, the start process event is never triggered. So I changed BpelDefinition class, startProcessInstance to have that triggered:public void startProcessInstance( ProcessInstance processInstance, Receiver trigger ) { Token scopeToken = processInstance.getRootToken(); ScopeInstance scopeInstance = ScopeInstance.get( scopeToken ); ExecutionContext context = new ExecutionContext( scopeInstance.getNormalFlowToken() ); try { scopeInstance.enableEvents(); // new line fireEvent( Event.EVENTTYPE_PROCESS_START, context ); new ProcessInstanceStarter( context, trigger ).visit( this ); } catch ( Throwable t ) { scopeInstance.getDefinition().raiseException( t, context ); } }
Thanks
AA -
3. Re: BPEL Process Instance
aguizar Feb 3, 2006 3:22 PM (in response to adrian.andrei)Big oops. I thought the ProcessInstance fired it upon its construction:
// fire the process start event if (rootToken.getNode()!=null) { ExecutionContext executionContext = new ExecutionContext(rootToken); processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_START, executionContext); }
At this point the root token will point to the start node if there is one. However, BPEL processes do not have a start node, as they could potentially have multiple start activities (i.e. < receive>s with createInstance="yes").
Thanks for reporting the problem. I'll just fire the event in BpelDefinition.createProcessInstance() rather than .startProcessInstance() to be more consistent with the jBPM behavior. Could you open a JIRA issue for tracking purposes? -
4. Re: BPEL Process Instance
adrian.andrei Feb 3, 2006 4:19 PM (in response to adrian.andrei)Done. See issue BPEL-89