Camunda REST API to get process instance

Hi All,

I’m trying to get the currently running process instances using REST API’s or using Camunda Cockpit, the process definition that I have contains only service tasks, and as I run the process, and hit the API “engine-rest/process-instance”, nothing returned even though the process is running, also it’s not shown in the cockpit. But after the process is completed I can see it in the history list as “COMPLETED”.
I tried the same API with a process that has a “user task”, and it worked for it, as it is shown in the cockpit and also returned using the API “engine-rest/process-instance”, with a status of “ACTIVE”.
Is there any I can get a process instance with all tasks as a service task?

Thanks.

By default a process containing only service tasks (if they implemented as java classes) does not have any transaction boundaries. This means that when you start it it will be be completed in the same transaction and will not be found by querying the runtime engine.

You can add transaction boundaries by ticking asynchronous before/afteron a service task.

Thanks for reply. I tried your suggestion, and it worked as I see the instances in the list, but there is another problem now, as an exception happens states that could not load the Camunda class:
“org.camunda.bpm.engine.ProcessEngineException: ENGINE-09008 Exception while instantiating class ‘com.iti.dexcenter.server.workflow.SetStatusCCS’: ENGINE-09017 Cannot load class ‘com.iti.dexcenter.server.workflow.SetStatusCCS’: com.iti.dexcenter.server.workflow.SetStatusCCS from [Module “org.camunda.bpm.camunda-engine:main” from local module loader @1ee807c6 (finder: local module finder @76a4d6c (roots: D:\Camunda\wildfly_11.3.0\modules,D:\Camunda\wildfly_11.3.0\modules\system\layers\base))]
at org.camunda.bpm.engine.impl.util.EngineUtilLogger.exceptionWhileInstantiatingClass(EngineUtilLogger.java:81)”

note that the class before the asynchronous was loaded successfully and the workflow is done successfully.
Any suggestions?

Thanks @Niall,
OK, now I solved the exception issue, but the asynchronous after/before as I see is the same as a break-point, and the process instance stops at it, which is not the behavior I’m looking for, as I want the process to continue running while I am requesting the API or viewing the Cockpit. consider the attached image to see the point the process stops at.

image

Thanks.

This is probably because of how you’re setup the job executor.
Take a look at this post, it’ll help you understand whats going on.

Thank you very much @Niall, I’ll take a look at that.

@Niall
I have read the post you mentioned and it was helpful. However, I tried all the steps in the document especially about the ACT_RU_JOB table. the fields LOCK_EXP_TIME_, LOCK_OWNER_, EXCEPTION_MSG_ have null values. Also RETRIES_ has 3 value.

This means the job executor/acquisition not pick up any job of the listed.

Do you know why this happens and how to fix it?

@Yusef Sounds like the Job executer does not pick up the Jobs you have avaiable. Have you tried deactivating jobExecutorDeploymentAware?

Thanks @martin.stamm,

I tried this, but I the same exception I had before, and states that could not load Class for the task.
Any suggestions would be very appreciated.