-
1. Re: [jBPME][3.1.1] Transition in timer
kukeltje Jun 8, 2006 6:53 AM (in response to ephemeris-lappis)I think there should be a transition with the same name as defined in the transition attribute so something like
<state name="activity-1"> <timer name="timer_activity-1" duedate="5 seconds" transition="to-activity-2"> <script> <expression> <![CDATA[ System.out.println("*** TIMER FIRED !!!"); ]]> </expression> </script> </timer> <transition name="to-activity-2" to="activity-2" /> <transition name="to-activity-3" to="activity-3" /> </state>
-
2. Re: [jBPME][3.1.1] Transition in timer
ephemeris-lappis Jun 8, 2006 8:00 AM (in response to ephemeris-lappis)I've tried this, but i doesn't change anything... The timer fires, but the transition is not activated. And, if the java code produces a signal on the root token, the next node is the normal transition, not the transition that is supposed to be selected by the timer...
<state name="activity-1"> <timer name="timer_activity-1" duedate="5 seconds" transition="activity-2"> <script> <expression> <![CDATA[ System.out.println("*** TIMER FIRED !!!"); ]]> </expression> </script> </timer> <transition name="to_activity-3" to="activity-3" /> <transition name="to_activity-2" to="activity-2" /> </state> <state name="activity-2"> <event type="node-enter"> <script> <expression> <![CDATA[ System.out.println("*** ENTERING : " + node); ]]> </expression> </script> </event> <transition to="activity-3" /> </state>
Another idea ?
Thanks anyway ! -
3. Re: [jBPME][3.1.1] Transition in timer
kukeltje Jun 8, 2006 10:56 AM (in response to ephemeris-lappis)wrong config. you reference the state in the transition attribute, not the transition name. Change 'activity-2' to 'to_activity-2' in the transition attribute
-
4. Re: [jBPME][3.1.1] Transition in timer
ephemeris-lappis Jun 8, 2006 11:37 AM (in response to ephemeris-lappis)OK : that was the mistake !
Muchisimas gracias !
Now i have another problem with the java code : the main program keeps a reference on the current process instance, its root token, etc. When the timer has fired and the transition has been activated as expected (since it works !), the persistent state seems broken, and an exception is thrown, chen the context is closed...
How the main java program can protected itself from external changes like timers execution ?
Here the partial stack trace :org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171) at org.jbpm.svc.Services.close(Services.java:211) at org.jbpm.JbpmContext.close(JbpmContext.java:141) at my.wf.five.Main.main(Main.java:101)
... and the java code :System.out.println("Starting scheduler..."); Scheduler scheduler = new Scheduler(); scheduler.setInterval(5000); scheduler.setHistoryMaxSize(50); scheduler.start(); System.out.println("Scheduler started..."); JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(); String myProcessDefinitionResourceName = "my/wf/five/BP5.xml"; ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(myProcessDefinitionResourceName); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { jbpmContext.deployProcessDefinition(processDefinition); } finally { jbpmContext.close(); } ProcessInstance processInstance = null; System.out.println("=== Sans timer..."); jbpmContext = jbpmConfiguration.createJbpmContext(); try { processInstance = new ProcessInstance(processDefinition); Token token = processInstance.getRootToken(); token.signal(); jbpmContext.save(processInstance); System.out.println("\tapres signal 1 : " + token.getNode().getFullyQualifiedName()); } finally { jbpmContext.close(); } jbpmContext = jbpmConfiguration.createJbpmContext(); try { Token token = processInstance.getRootToken(); token.signal(); jbpmContext.save(processInstance); System.out.println("\tapres signal 2 : " + token.getNode().getFullyQualifiedName()); } finally { jbpmContext.close(); } jbpmContext = jbpmConfiguration.createJbpmContext(); try { Token token = processInstance.getRootToken(); token.signal(); jbpmContext.save(processInstance); System.out.println("\tapres signal 3 : " + token.getNode().getFullyQualifiedName()); } finally { jbpmContext.close(); } System.out.println("=== Avec timer..."); jbpmContext = jbpmConfiguration.createJbpmContext(); try { processInstance = new ProcessInstance(processDefinition); Token token = processInstance.getRootToken(); token.signal(); jbpmContext.save(processInstance); System.out.println("\tapres signal 1 : " + token.getNode().getFullyQualifiedName()); } finally { jbpmContext.close(); } { Thread.sleep(10000); Token token = processInstance.getRootToken(); System.out.println("\tapres sleep 2 : " + token.getNode().getFullyQualifiedName()); } jbpmContext = jbpmConfiguration.createJbpmContext(); try { Token token = processInstance.getRootToken(); token.signal(); jbpmContext.save(processInstance); System.out.println("\tapres signal 3 : " + token.getNode().getFullyQualifiedName()); } finally { jbpmContext.close(); } scheduler.stop(); System.out.println("OK !!!");
-
5. Re: [jBPME][3.1.1] Transition in timer
kukeltje Jun 8, 2006 11:38 AM (in response to ephemeris-lappis)please start new problems in new topics. I'll be glad to repsond there
-
6. Re: [jBPME][3.1.1] Transition in timer
ephemeris-lappis Jun 8, 2006 11:42 AM (in response to ephemeris-lappis)OK. I'll post a new topic...