The code which wraps the execution of this business process saves the process instance
both before the business process is executed and after. Here is the code:
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| log.debug("[solicit]: Getting graph session.");
| GraphSession graphSession = jbpmContext.getGraphSession();
| log.debug("[solicit]: Finding process definition: Solicit");
| ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("Solicit");
| log.debug("[solicit]: Creating new process instance:Solicit");
| ProcessInstance processInstance = new ProcessInstance(processDefinition);
| // set variables
| log.debug("[solicit]: Creating new context instance.");
| ContextInstance ci = processInstance.getContextInstance();
| log.debug("[solicit]: Setting context instance variables.");
| ci.setVariable(PVAR_authenticationToken, securityToken);
| ci.setVariable(PVAR_request, request);
| ci.setVariable(PVAR_returnURL, returnURL);
| ci.setVariable(PVAR_bpparameters, parameters);
| log.debug("[solicit]: Saving process instance: Solicit");
| jbpmContext.save(processInstance);
| log.debug("[solicit]: Executing business process: Solicit");
| processInstance.signal();
| log.debug("[solicit]: Saving process instance: Solicit");
| jbpmContext.save(processInstance);
| String transactionId = (String)
processInstance.getContextInstance().getVariable(PVAR_queryResult);
| log.info("[solicit]: Returning transactionId=" + transactionId);
| return transactionId;
| } catch (Exception ex) {
| Throwable cause = ex.getCause();
| if (cause != null && cause instanceof NodeException) {
| throw (NodeException) cause;
| }
| log.error("[solicit]: Unknown error occurred while trying to execute business
process: Solicit", ex);
| throw new NodeException("Unknown error occurred while trying to execute
business process: Solicit", ex, ErrorCode.Code.E_UNKNOWN_ERROR);
| } finally {
| jbpmContext.close();
| log.debug("[solicit]: Exit.");
| }
|
So I save the process instance prior, the business process which creates the timer and
saves it to the scheduler is invoked, and the business process completes, and the process
instance is saved again. Shouldn't this save the timer to the database?
Thanks,
Brad
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962325#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...