Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to get status of a short lived process?

Avatar

Level 3
I have a short-lived process I call from servlet (submit servlet), I would know when the process has completed, I tried the following code, but it says



[3/3/09 10:35:37:593 PST] 0000002f SystemErr R Caused by: com.adobe.idp.jobmanager.common.JobNotFoundException



InvocationResponse invokeResponse = myServiceClient.invoke(invokeRequest);

String invocationId = invokeResponse.getInvocationId();



JobManager jobManager = new JobManager(myFactory);

JobId myJobId = new JobId(invocationId);



int counter = 0;

while((jobManager.getStatus(myJobId).getStatusCode() == JobStatus.JOB_STATUS_RUNNING) && ++counter < 60) {

Thread.sleep(1000);

}



Any help would be appreciated. Thanks in advance.
5 Replies

Avatar

Former Community Member
The short lived process means that you will wait for the status. So there is no subsequent call to get the status.

Avatar

Level 3
Doh, I see...



Then could be kind and tell me how to get that status? Thanks.

Avatar

Former Community Member
The service will run and return any output variables back to the caller. There is no status to return...just outputs.

Avatar

Former Community Member
Nelson



As Paul has stated, there really isn't a good way to get the "status" of a short-lived process because being able to get such a status goes against what a short-lived process is intended for. Typically a short-lived process would run and promptly return any outputs to you. Personally, I like to distinguish long-lived versus short-lived by associating user steps with long-lived and their absence with short-lived (since short-lived processes can't have any user steps anyway). If you are still wanting to be able to retrieve the status of your process, I might encourage you to make it long-lived instead. This way, the tb_process_instance table can be used to check the process's status via its complete_time column. Alternatively, you could have a status variable in the orchestration itself such as a string you could update whenever you want to update the status. Since all process variables for long-lived processes are stored in the database, you could check this value to see where you're at with the process.



If you have any questions, please do let me know. You can email me directly or just respond on these forums. Good luck!



Josh Boyle

jboyle@cardinalsolutions.com

Cardinal Solutions Group

Avatar

Level 3
Yup, it makes perfect sense now~ Thanks guys for your help.