Author |
Message
|
amittalekar |
Posted: Mon Jul 22, 2002 9:40 am Post subject: Restart RUNNING processes which are not processing |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Hi,
I have a process which contain some automatic steps. All these steps are
synchronous.
There is possiblity that while processing response xml, server goes down or the response xml message generated is not proper. In this case , the process will not move ahead. It will be waiting for response in RUNNING state. My requirement is that I want to restart such processes
which are waiting for more than an hour. How can I do this?..OR how can I get the timestamp for the last activity in this process ?
There seems to be no API which will return me such processes. There is API which will return me all the processes which are in RUNNING state.
"LastModifiedTime" can not be used in the filter as for the Process Instances this time is same as creation time. |
|
Back to top |
|
 |
jmac |
Posted: Tue Jul 23, 2002 4:38 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
What you need to do is to ForceRestart the activity which is in the running state (puts it back in Ready), then start that activity agin (puts in Running), and hopefully this time the activity completes, and your process marches on.
Good Luck. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
amittalekar |
Posted: Tue Jul 23, 2002 2:21 pm Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
But How do i distinguish such a process as there are other processes which are running properly or eventhough some may be waiting for response but not more than past hour(say). I want to restart only those processes which are not processing (in RUNNING state) for say past hour. |
|
Back to top |
|
 |
jmac |
Posted: Tue Jul 23, 2002 3:03 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
You could use the LastModifiedTime to caluclate how long ago the last state change occurred. You can probably even use a filter to have only those that are at least an hour old returned to a queryItems command.
Good Luck _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
kriersd |
Posted: Tue Jul 23, 2002 5:09 pm Post subject: |
|
|
 Master
Joined: 22 Jul 2002 Posts: 209 Location: IA, USA
|
If I understand your question right your asking for help finding the workitems using the API's. :o
Ok. You will need to first bulid a worklist with a filter. You can then filter by "OWNER = CURRENT_USER AND STATE = RUNNING AND LAST_MODIFICATION_TIME=?".
You may need to check the doc on how to build the filter to ensure your getting only the work items you want.
EXAMPLE IN JAVA
________________ C O D E __________
String workListName = "myworklist";
String workListFilter = "OWNER = CURRENT_USER AND PROCESS_CATEGORY = 'mycategory' AND STATE IN ( READY, CHECKED_OUT )";
String workListSort = "RECEIVED_TIME DESC";
ExecutionService service = context.getExecutionService();
// if the users list does not exist, create it
// NOTE ONLY ADMIN can create a public worklist.
if (workList == null)
{
workList = service.createWorkList(workListName,com.ibm.workflow.api.PersistentListPackage.TypeOfList.PRIVATE,null,null,workListFilter,workListSort,null);
}
// since the worklist was just created,
// requery the worklist
// query and cache all worklists
builtin.queryWorkLists(context);
________________ E N D C O D E ____
Hope this helps you.. _________________ Dave Krier
IBM WebSphere MQ Workflow V3.4 Solution Designer |
|
Back to top |
|
 |
amittalekar |
Posted: Tue Jul 23, 2002 6:25 pm Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
Hey thanks for responses.....
I believe that LastModifiedTime for the process changes only if state of process is changed. Consider a scenario where process contains first activity as automatic activity. Once process is started it will be in the RUNNING state. Suppose because of some unusual problem the response xml message at the first activity is lost. In this case the process will be in the RUNNING state but will not proceed firther and lastModifiedTime will be same as process creation time.
Consider a second scenario where there is a second process which contain some automatic activities. Say this process is running successfully for last hour. This process is still not completed and also there is no problem. In this case also lastModifiedTime will be same as creation time.
But my requirement is I want to restart only the first process and not the second. If I query using filter I will get both the processes where as I want only process which is really not processing. how can i do this???? |
|
Back to top |
|
 |
jmac |
Posted: Wed Jul 24, 2002 4:48 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Why are you looking at the ProcessInstance, I believe that you should be looking at the Workitem.
Isn't it the Workitem that you want to restart? _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
amittalekar |
Posted: Wed Jul 24, 2002 6:54 am Post subject: |
|
|
 Disciple
Joined: 03 Apr 2002 Posts: 166 Location: VA, USA
|
I explain u in detail what I am doing. I have a program which listens to queue. For the UPES activity when message comes in the queue my program picks up that message. Conver this xml message into java objects, do some process on these objects and after processing again generates the response xml and put it in a EXEXMLINPUT queue.
If while processing the input xml and before putting the response xml in the EXEXMLINPUT queue, some failure condition occurs and the response message is not put in the Queue then the process will be waiting for response at that particular activity. At the same time I have lost the input xml message. In this situation WorkItem will never be created for this process as well as the lastModifiedTime for process will be same as creation time. How do I track such processes???....This situation is rare but still have to handle this as a precautionary measure....... |
|
Back to top |
|
 |
jmac |
Posted: Wed Jul 24, 2002 7:55 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
What you should use in this case is a ForceRestart against the ActivityInstance. This will cause a workitem to be created, which can then be started agian. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
|