ForceFully complete a process Instance

Hii community,
I have a use case where with the main flow i have 10-15 number of event subprocesses in my processDefinition , And i am waiting for an event in my main flow , if that event comes ,i will do the message correlation and want to complete the process instance , but if eventSubprocesses have some activities in active or in incident state i want to close them forcefully , How i can achive this using zeebe java client

example : i have a event subprocess which have three activities sequentially Activity A , Activity B , Activity C , and Activity A is in active state , i got the event in main flow , so there is no point in executing A , B and C , i want to close these eventSubprocess , How i can do these/.

Can you post a model of this, it’ll make it a little more clear what you’re working with

Hii @Niall , Sure

My use case is these:
1)In these Subprocess1 , these workerSubProcess1 is in active state
2)In these event subprocess2 , worker A is having incident.
3) and in the main flow both correlations are done for OperationsCompleted and FlowCompleted and CompleteCamundaProcessInstance is executing.

If flow is at these posiition CompleteCamundaProcessInstance , it means my orchestration is completed , now i dont want to resolve the incident neither i want these worker A , worker B and worker C to be executed , but it doesn’t matter if my processInstance reach to end event , if subprocesses having incident or are in active state , camundaProcessInstance will not get closed , how i can achieve these.

I think the terminate end event may be help.
such as:
image
You need send a signal event in the CompleteCamundaProcessInstance.
The terminate end event will cancel the whole subprocess which it is in.

Since the worker A has been in active, the business logic in it is still running.

But these signal event will broadcast signal to all Process Instances of that process Definition , I want to close subprocesses of single processInstance.

1 Like

Hi @Ansh_Kumar

If your need is to kill whatever execution tokens are running in the event sub-processes once CompleteCamundaProcessInstance is completed then you can use a terminate end event instead of the normal end event following CompleteCamundaProcessInstance service task.

If your need is to kill only a selective set of activities(s) from within event sub-processe(s) then I believe that conditional events would be the best choice from a modeling perspective but Camunda 8 still doesn’t support conditional events

You can specify a name of the signal event by a variable which is specified when the process starts.
That means the signal event in each instance will have a different name.