JBoss Community

How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3.

reply from Felix Jose in jBPM - View the full discussion

Hi All,

 

I have write a JBPM main process (Request.jpdl.xml) for starting "n" subprocess depending upon the input(number of users) and is given below

 

 

 

 

 

 

 

 

 

 

 

<java class="com.felix.poc.TestActivity" method="decreaseForkCounter"  name=

"decreaseForkCounter" var="request" g="570,94,149,40"> 

<arg> 

<object expr="#{request}" /> 

</arg>

<transition g="-71,-18" name="sendToAssist" to="sendToAssist" />

</java>

 

<decision g="250,208,48,48" name="decideForkAgain">

<handler class="com.felix.poc.ForkAgainHandler" />

<transition g="274,113:78,-18" name="FORK_AGAIN" to="decreaseForkCounter" />

<transition g="280,556:172,-23" name="FORK_NOT_AGAIN" to="join1" />

</decision>

<fork g="623,207,80,40" name="sendToAssist">

<transition name="assist" to="assist" g="-16,-16" />

<transition g="-39,-18" name="decideForkAgain" to="decideForkAgain" />

</fork>

 

<sub-process g="753,210,80,40" name="assist" sub-process-key="Assist">

<ransition g="14,16" name="join1" to="join1" />

</sub-process>

<join g="777,529,80,40" name="join1">

<transition g="-31,-18" name="end" to="theEnd" />

</join>

 

I have atttached the same application with this.

 

But when I am trying to start multiple sub processes I am getting the following exception:

 

Drecreased fork counter to:2

2796 [main] INFO com.felix.poc.TestActivity - Drecreased fork counter to:1

2796 [main] INFO org.hibernate.event.def.DefaultDeleteEventListener - handling transient entity in delete processing

Fork counter is 1

2827 [main] INFO com.felix.poc.ForkAgainHandler - Fork counter is 1

fork again

2827 [main] INFO com.felix.poc.ForkAgainHandler - fork again

Drecreased fork counter to:1

2827 [main] INFO com.felix.poc.TestActivity - Drecreased fork counter to:0

Fork counter is 0

2843 [main] INFO com.felix.poc.ForkAgainHandler - Fork counter is 0

2843 [main] INFO com.felix.poc.ForkAgainHandler - fork finished

2874 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: -104, SQLState: 23000

2874 [main] ERROR org.hibernate.util.JDBCExceptionReporter - 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_=?]

2874 [main] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session

org.hibernate.exception.ConstraintViolationException

 

 

: could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#26]

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)

at org.hibernate.engine.ActionQueue.executeActions(

ActionQueue.java:263)

at org.hibernate.engine.ActionQueue.executeActions(

ActionQueue.java:168)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(

AbstractFlushingEventListener.java:321)

at org.hibernate.event.def.DefaultFlushEventListener.onFlush(

DefaultFlushEventListener.java:50)

at org.hibernate.impl.SessionImpl.flush(

SessionImpl.java:1027)

at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(

HibernateSessionResource.java:56)

at org.jbpm.pvm.internal.tx.StandardTransaction.commit(

StandardTransaction.java:107)

at org.jbpm.pvm.internal.tx.StandardTransaction.complete(

StandardTransaction.java:64)

at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(

StandardTransactionInterceptor.java:61)

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.svc.SkipInterceptor.execute(

SkipInterceptor.java:43)

at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(

ExecutionServiceImpl.java:70)

at com.felix.poc.Starter.main(

Starter.java:31)

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)

... 19 more

 

 

So how can I start the multiple suprocesses? How can I get rid from this exception.

I am attching the test application with this. Please help me.

 

Thank you,

With Regards,

Felix K Jose

 

 

So how can I start the multiple suprocesses? How can I get rid from this exception.

I am attching the test application with this. Please help me.

 

Thank you,

With Regards,

Felix K Jose

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reply to this message by going to Community

Start a new discussion in jBPM at Community