cancel
Showing results for 
Search instead for 
Did you mean: 

Terminating an active process instance

amuthuse
Champ in-the-making
Champ in-the-making
How do we terminate a process instance. I see APIs for suspending and resuming a process. But nothing as such for terminating a process.

We do have such business use cases.

For example, in a loan approval process, while the process is underway, the applicant might come up with a cancellation request. So, we have to terminate the process instance. Suspend will not be appropriate for this use case. We can not probably use error end, because practically the cancel request can come up at any point of time and the execution can be at any ( rather many ) node in the process.

And I am interested in knowing if there are any standard process pattern for this use case.
5 REPLIES 5

p4w3l
Champ in-the-making
Champ in-the-making
Pls don't treat this as an authoritative answer. Just sharing my point of view:

1. The BPMN on level of its definition manages all cases including cancellation. It can be done by boundary event or so. Check the UM for details

2. Completely delete the process instance with RuntimeServicedeleteProcessInstance(String processInstanceId, String deleteReason). Then you loose the history I bet.

nemesis1
Champ in-the-making
Champ in-the-making
Pls don't treat this as an authoritative answer. Just sharing my point of view:

1. The BPMN on level of its definition manages all cases including cancellation. It can be done by boundary event or so. Check the UM for details

2. Completely delete the process instance with RuntimeServicedeleteProcessInstance(String processInstanceId, String deleteReason). Then you loose the history I bet.


Hi;
cancel activity of boundary event is not working properly. (I am waiting for this property.) Is there any development on this subject.
When I check the status of item; I see it is resolved. İs there anyone who will validate it is solved.
http://forums.activiti.org/en/viewtopic.php?f=6&t=3789&p=15266&hilit=cancel+activity#p15266

thanks.

nemesis1
Champ in-the-making
Champ in-the-making
I tried it on activiti 5.9.3. It does not work when cancel activity is set false.


com.vaadin.event.ListenerMethod$MethodException
Cause: com.vaadin.event.ListenerMethod$MethodException
Cause: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PROCINST: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_INST_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_)"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? [23003-132]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:374)
at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:391)
at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:271)
at org.h2.table.Table.fireConstraints(Table.java:766)
at org.h2.table.Table.fireAfterRow(Table.java:783)
at org.h2.command.dml.Delete.update(Delete.java:79)
at org.h2.command.CommandContainer.update(CommandContainer.java:70)
at org.h2.command.Command.executeUpdate(Command.java:198)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:298)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:135)
at java.lang.Thread.run(Thread.java:619)

### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### Cause: org.h2.jdbc.JdbcSQLException: Referential integr

amuthuse
Champ in-the-making
Champ in-the-making
Pls don't treat this as an authoritative answer. Just sharing my point of view:

1. The BPMN on level of its definition manages all cases including cancellation. It can be done by boundary event or so. Check the UM for details

2. Completely delete the process instance with RuntimeServicedeleteProcessInstance(String processInstanceId, String deleteReason). Then you loose the history I bet.


I couldnt find enough info about the first approach in UM. I would appriciate if you/anyone share some more details about it.

second approach, wont be applicable to most of the usecases, since we cant afford to lose the history.

vivalg
Champ in-the-making
Champ in-the-making
I encountered the same problem, then I found out that when you delete a process instance, activiti engine just remove the process instance from active process instances, and make a 'delete reason' mark on the historic process instance, all the historic record will be kept in database.
so if you want to terminate a process instance, you just call runtimService.deleteProcessInstance()