Hello all!

I want to use asynchron process execution. 
Therefore, i have an action in a node, in which the thread waits 10 seconds to 
simulate a long calculation.

Without the asynchron execution, i call the signal method on a state, the 
processinstance enters the node and after 10 seconds, the processinstance 
leaves the node and the processinstance is in the next state element. 

As far as i understand the tutorial, with asynchron execution, the 
processinstance should at once enter the state after the asynchron node, 
without waiting for the execution of the action.

anonymous wrote : 
  | Note that the jbpm client code can now commit the transaction. The sending 
of the message should be done in the same transaction as the process updates. 
So the net result of the transaction is that the token has moved to the next 
node (which has not yet been executed) and a 
org.jbpm.command.ExecuteNodeCommand-message has been sent on the asynchronous 
messaging system to the jBPM Command Executor.

But i have the situtation, that the client thread doesn't wait for the 
callculation but regardless the processinstance is in the tooken has not moved 
to the next state. the tooken still is in the asynchron node.

here is the code i used ( which runs without problems, if i use synchron 
execution and also if i use asynchron execution, there are no errors. i just 
wonder, why the token does not move...) :

  | 
  | //get the processinstance and so on....
  | 
  |             processInstance.signal("created");
  |    
  |             jbpmContext.save(processInstance);
  |             processInstance = null;
  |             
  |             newTransaction();
  |             
  |             processInstance = 
jbpmContext.loadProcessInstance(processId.longValue());
  | 
  | 
  |             //at this point i thougt, by asynchron execution the tooken has 
to 
  |             //be in the state element after the asynchron node, but the 
  |             //tooken is still in the node.
  | 
  |             logger.info("the processinstance is in : " + 
processInstance.getRootToken().getNode().getName());
  | 
  | //doing stuff like close the context....
  | 
  | 
  |     
  | protected void newTransaction() {
  |      try {
  |           commitAndCloseSession();
  |           beginSessionTransaction();
  |      } catch (Throwable t) {
  |           throw new RuntimeException("couldn't commit and start new 
transaction", t);
  |         }
  |       }
  | public void commitAndCloseSession() {
  |       jbpmContext.close();
  |       resetMembers();
  |       }
  |     
  | protected void initializeMembers() {
  |      session = jbpmContext.getSession();
  |      graphSession = jbpmContext.getGraphSession();
  |      taskMgmtSession = jbpmContext.getTaskMgmtSession();
  |      loggingSession = jbpmContext.getLoggingSession();
  |      schedulerSession = jbpmContext.getSchedulerSession();
  |      contextSession = jbpmContext.getContextSession();
  |      messagingSession = jbpmContext.getMessagingSession();
  |    }
  |       
  | protected void resetMembers() {
  |      session = null;
  |      graphSession = null;
  |      taskMgmtSession = null;
  |      loggingSession = null;
  |      schedulerSession = null;
  |      contextSession = null;
  |      messagingSession = null;
  |    }
  |    public void beginSessionTransaction() {
  |        jbpmContext = 
MyJbpmConfigurationLoader.getConfiguration().createJbpmContext();
  |        initializeMembers();
  |        logger.info("--- starting new transaction 
-------------------------------------------------");
  |      }
  | 
  | }
  | 

Is there something wrong with my code or does the asynchron execution behave in 
that way like i thought? I am using the starterkit 3.1.1 and jpdl 3.1. 

Thanks,
asmo

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999425#3999425

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3999425
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to