AnsweredAssumed Answered

Can we have a signal boundary event on a multiprocess instance ?

Question asked by gsharma on Oct 4, 2017

I am having a multi instance user task MT inside an embedded sub process. The multi instance user task MT has task listener set on completion of task. The listener evaluates a condition and if true triggers the boundary signal event. The boundary signal event moves the flow to another user task UT inside the same sub process.

Here is a snippet from my process definition,

 

<signal id="signal_start_final_verification" name="SIGNAL_START_FINAL_VERIFICATION" activiti:scope="processInstance"></signal>
...
...
<boundaryEvent id="..." name="..." attachedToRef="MT" cancelActivity="false">
<documentation>...</documentation>
<signalEventDefinition signalRef="signal_start_final_verification"></signalEventDefinition>
</boundaryEvent>

 

In order to signal UT, I use the following snippet in my on completion task listener of MT. It is executed only when a certain condition evaluates to true.

 

Execution execution = runtimeService.createExecutionQuery()
.processInstanceId(delegateExecution.getProcessInstanceId())
.signalEventSubscriptionName("SIGNAL_START_FINAL_VERIFICATION")
.singleResult();

 

runtimeService.signalEventReceived("SIGNAL_START_FINAL_VERIFICATION", execution.getId());

 

Lets say that the multi instance loops 5 times and the condition evaluates to true at 2nd, 4th and 5th instance. The MT task instances are completed but UT is not created or spawned though at 2nd and 4th instance. During execution of onComplete listener of 5th instance task, UT is again not created and the MT task instance rolls backs with following exception.

 

org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable"
Detail: Key (id_)=(695101) is still referenced from table "act_ru_variable".
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntityImpl.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable"
Detail: Key (id_)=(695101) is still referenced from table "act_ru_variable".
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213)
...
...

I am failing to debug why the boundary signal event is not being triggered and why the last instance of multi instance user task raises exception while executing its onComplete task listener.

Outcomes