-
1. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
rebody Apr 13, 2010 3:56 AM (in response to nsaputro)1 of 1 people found this helpfulHi Nugroho,
You should use ((ActivityExecution) execution).takeDefaultTransition(); The parent of the current execution is in the inactive-scope state.
-
2. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
nsaputro Apr 13, 2010 4:39 AM (in response to rebody)Huisheng Xu wrote:
Hi Nugroho,
You should use ((ActivityExecution) execution).takeDefaultTransition(); The parent of the current execution is in the inactive-scope state.
Huisheng, thank you for your suggestion. I tried that but it still does not take to next state.
I got this error if repeat attribute is specified on timer:
{code}
13 Apr 2010 15:35:50 INFO org.jbpm.pvm.internal.svc.DefaultCommandService - exception while executing command org.jbpm.pvm.internal.jobexecutor.GetNextDueDateCmd@d83365 org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.pvm.internal.model.ExecutionImpl#22] at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:409) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:171) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590) at org.hibernate.type.EntityType.resolve(EntityType.java:412) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877) at org.hibernate.loader.Loader.doQuery(Loader.java:752) at...
{code}
if I remove repeat attribute, no exception is thrown, but it's still in the current state (Check Order Status).
-
3. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
swiderski.maciej Apr 13, 2010 12:06 PM (in response to nsaputro)1 of 1 people found this helpfulHi,
in my opinion event listeners should not be used to change the flow of the process. It should be treated as additional hooks in the process that are not visible on the process diagram and that's why are perfect for non business related activities such as logging, event submition, etc.
What you could do it so you timer transition, as follows:
<transition name="timeout" to="escalation"> <timer duedate="10 minutes" /> </transition>
If you put this in your wait node after 10 minutes (unless it will be signaled) transition will be taken.
In your case you could either check all you need in associated event listener when taking this transition or have a user activity (java, custom) for such a check. Next you move on to decision point to verify what to do, if status is not yet correct go back to wait state to wait another 10 minute or move on with your process.
HTH
Maciej
-
4. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
nsaputro Apr 13, 2010 12:34 PM (in response to swiderski.maciej)Hi Maciej,
Thank you for your suggestion.Unfortunately I get another exception when timer on re-check transition is executed by jobexecutor:
{code}
23:22:03,041 SEV | [JobParcel] exception in job blockorg.springframework.dao.DataIntegrityViolationException: could not update:[org.jbpm.pvm.internal.model.ExecutionImpl#17]; nested exception is org.hibernate.exception.ConstraintViolationException:could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#17]at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:636)at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:789)at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:663)at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)at org.jbpm.pvm.internal.jobexecutor.JobParcel.run(JobParcel.java:48)...Caused by: org.hibernate.exception.ConstraintViolationException: could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#17]at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2453)at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)....Caused by: java.sql.SQLException: Violation of unique constraint $: duplicate value(s) for column(s) $: SYS_CT_50 in statement[update JBPM4_EXECUTION set DBVERSION_=?, ACTIVITYNAME_=?, PROCDEFID_=?, HASVARS_=?, NAME_=?, KEY_=?, ID_=?,STATE_=?, SUSPHISTSTATE_=?, PRIORITY_=?, HISACTINST_=?, PARENT_=?, INSTANCE_=?, SUPEREXEC_=?, SUBPROCINST_=?where DBID_=? and DBVERSION_=?]at org.hsqldb.jdbc.Util.throwError(Unknown Source)at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)... 26 more{code}
Do you have any idea why I get this exception?
-
5. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
swiderski.maciej Apr 13, 2010 12:45 PM (in response to nsaputro)yeap, I had that as well, there is already open issue for that. Problem is with creating timer in a wait node after going though the loop. The id is the same as for the expired one and both are inside the same transaction.
A workaround for this is to make continuation of the activity (Check Order status) as async. Just add to your (assuming it is java) activity following attribute:
continue="async"
And that error should go away.
Cheers,
Maciej
-
6. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
nsaputro Apr 13, 2010 1:00 PM (in response to swiderski.maciej)Maciej Swiderski wrote:
yeap, I had that as well, there is already open issue for that. Problem is with creating timer in a wait node after going though the loop. The id is the same as for the expired one and both are inside the same transaction.
A workaround for this is to make continuation of the activity (Check Order status) as async. Just add to your (assuming it is java) activity following attribute:
continue=async
And that error should go away.
Cheers,
Maciej
Thank you Maciej. It works.
-
7. Re: JBPM 4.3: Is it possible to leave current state on timer listener?
vcr Nov 16, 2010 4:00 AM (in response to nsaputro)I am trying to get the current activityExecution like in the above example:
ActivityExecution execution = (ActivityExecution) event.getParent();
but I get null. What can be the problem? Thanks.