How to gracefully terminate the process without creating an incident

Hi Team,

I am facing a challenge in terminating my process instance gracefully on request using JAVA APIs, I have some failure conditions in my code base once those fulfill, i need to terminate the process, I got it terminated by using two options:

  1. processEngine.getRuntimeService().deleteProcessInstanceIfExists(item, execution.getVariable(“errorMessage”).toString(), true, true, true, true);
  2. processEngine.getRuntimeService().deleteProcessInstance(processInstanceId, “Error Occurred”);

The problem is when I am using any one of the above method, my previous transactions is getting rollback and an incident is getting creating created.

My goal is to not rollback any previous transaction and no incident should be created.

Please suggest how to terminate a running process based on some conditions, committing all the previous transactions to Database and with no incident creation.

Appreciate all the support.


Your could use an interrupting event driven subprocess which ends the containing process. You could trigger this by a message.

See docs for detail. This will give you a clean termination.



1 Like

Thanks Rob. I tried to implement an event driven sub process and trying to throw signal event using below code:


The signal is not being thrown.

I have attached the process. Please take a look what I am missing here.

FileRestartProcess.bpmn (51.1 KB)


are you raising this signal event from outside your process or from within your process? Also do you mean the signal is not being raised (eg send) or not being caught?



Hi Rob,

I am raising this signal within my process and I am unable to send it through above mentioned Java API.


when you say you are unable to send it via the API, what do you observe? Is an exception thrown etc?



Yes, I am getting below exception.

[WARN ] o.c.b.e.jobexecutor                      [L:146  ]- ENGINE-14006 Exception while executing job 6c62d813-29a2-11eb-9f1b-bca8a6f539f3: 
org.springframework.transaction.UnexpectedRollbackException: Transaction silently rolled back because it has been marked as rollback-only
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(