Highlighted

How to get status of a short lived process?

Avatar

Avatar

Clookes

Avatar

Clookes

Clookes

03-03-2009

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.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

03-03-2009

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

Avatar

Avatar

Clookes

Avatar

Clookes

Clookes

03-03-2009

Doh, I see...



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

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

03-03-2009

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

Avatar

Avatar

JoshDBoyle-DVzR

Avatar

JoshDBoyle-DVzR

JoshDBoyle-DVzR

05-03-2009

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
Highlighted

Avatar

Avatar

Clookes

Avatar

Clookes

Clookes

05-03-2009

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