How to determine when process is complete after signal()?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2013 02:46 PM
Hello,
I have an issue where I pass the process/execution a process variable, signal() it which executes tasks that work on the varaible, and then try to retrieve the variable again. Everything works fine, unless the endEvent is encountered at which point the execution no longer exists and the variables are in history. So my question is, how can I determine if the endEvent has occurred?
Snippet:
Thanks
I have an issue where I pass the process/execution a process variable, signal() it which executes tasks that work on the varaible, and then try to retrieve the variable again. Everything works fine, unless the endEvent is encountered at which point the execution no longer exists and the variables are in history. So my question is, how can I determine if the endEvent has occurred?
Snippet:
// get the process instance id from objectString piid = request.getProcessInstanceId();…// add the request process variableruntimeService.setVariable(execution.getId(), "request", request); // propagate processruntimeService.signal(execution.getId()); // retrieve the request from the workflowrequest = (IPncRequest) runtimeService.getVariable(piid, "request");
Thanks
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2013 06:39 PM
Disclaimer - I'm just getting started with Activity.
It should be possible to tell whether it has ended based on the records in the database. For example, if the execution is in ACT_RU_EXECUTION, I believe that means it hasn't reached an end event. Or if the corresponding entry in ACT_HI_PROCINST has an end time, then it ended. But there would be a race condition if you check that and take action, so perhaps even if it appear to be running, you need to handle the case where it completes before you can query the variable (if it fails, then check the history for the value).
Someone more experienced may have a better recommendation.
It should be possible to tell whether it has ended based on the records in the database. For example, if the execution is in ACT_RU_EXECUTION, I believe that means it hasn't reached an end event. Or if the corresponding entry in ACT_HI_PROCINST has an end time, then it ended. But there would be a race condition if you check that and take action, so perhaps even if it appear to be running, you need to handle the case where it completes before you can query the variable (if it fails, then check the history for the value).
Someone more experienced may have a better recommendation.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2013 09:42 AM
Indeed, use the executionQuery() or processInstanceQuery() to find out if any result is returned or not when querying execution/process by id.
Or check the exception, it's of type ActivitiObjectNotFoundException() with a member field that indicates what entity is not found
Or check the exception, it's of type ActivitiObjectNotFoundException() with a member field that indicates what entity is not found
