How to asynchronously start process?

Is this the correct way to implement process engine in an asynchronous way. it seems to me that the process instances never seem to shut down or end
EDIT : How do i make this whole process asynchronous in such a way that multiple requests to the process invocation can run simultaneously since multiple requests are made to the process and each process thread needs to wait for a REST reponse from an external api request made internally in a service task

Workflow of my implementation

  1. rest request is made to sping boot api implemented in @controller class
  2. Spring boot api invokes @service class
  3. method of @Service class invokes runtimeService.startProcessInstanceByMessage(“main-process-start-event”,processVariables);;
  4. on a certain condition bpmn1 invokes another bpmn

if more details are requiired please mention, attaching my bpmn diagrams
process.bpmn (9.3 KB)
process1.bpmn (9.6 KB)

Hi @anoopmoorthy ,

Your process instance ends as soon as it reaches the end event.

In the bpmn file I see that you implement your service tasks as Java Classes. As you just have service tasks that means that the whole process happens in one transaction (synchronously).

So in this case you don’t see an active instances in Cockpit as everything happens in the same thread of the engine. From the model I would assume that your instances are ending before you have the chance to observe any active instance. Is that what you mean or why is your assumption that your instances are not ending?

I hope that helps
-Nele

@Nele How do i make this whole process asynchronous in such a way that multiple requests to the process invocation can run simultaneously since multiple requests are made to the process and each process thread needs to wait for a REST reponse from an external api request made internally in a service task