Issue with suspending and resuming workflows | Community
Skip to main content
viveksachdeva
New Participant
October 16, 2015
Solved

Issue with suspending and resuming workflows

  • October 16, 2015
  • 9 replies
  • 3561 views

When I call workflowSession.suspend() from any step, the workflow gets suspended after completing the whole step(I expected it to suspend right at the point when I called suspend method) and I am not able to resume it again using worfsess.resume(). It stays as it was earlier. When I resume it from console, the status changes to "Running"but it doesnt proceed any further.

 
Has anyone faced something like this?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Runal_Trivedi

You will need to call workflowsession.complete to take the workflow to the next step. Resuming the workflow doesn't automatically take the workflow to next step. I know that's the weird behavior but that's how workflow resume option behaves.

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowSession.html#complete%28com.day.cq.workflow.exec.WorkItem,%20com.day.cq.workflow.exec.Route%29

Also there is a catch here, if somebody resumes the workflow from UI there it is stuck because when you trigger resume from UI it just doesn't call complete and take workflow to next step, it keeps the workflow on same step with workflow step status as complete. You can validate that from history option of workflow instance.

- Runal

9 replies

Lokesh_Shivalingaiah
New Participant
October 16, 2015

did you check the logs what happens when you resume the workflow ?

viveksachdeva
New Participant
October 16, 2015
Woo.. Thats strange... So do I need to call resume and then complete or just complete.. And workflow completes whole step even if I suspend it in the beginning of step... Is that correct/expected   
viveksachdeva
New Participant
October 16, 2015
Yes.. I am passing correct I'd. Moreover resuming it from the console also doesn't take it any further.. It just says workflow running with first step completed with no info on next step which is a participant step... And even on suspending it. It continues on to complete that step and then suspends the workflow   
viveksachdeva
New Participant
October 16, 2015

Nothing... It just doesnt proceed to next step

Runal_Trivedi
New Participant
October 16, 2015

You can either of the following:

  1. complete and then suspend.
    • Doing so, the workflow item will appear in the inbox of next step participants, though participants wont be able to act on the step as the workflow is in suspended state.
    • session.complete(item, (session.getRoutes(item)).get(0)); session.suspendWorkflow(item.getWorkflow());
  2. resume and then complete.
    • Doing so will only make workflow item appear in inbox of participants in next step, till the point you resume it; it won't appear in the inbox of participants.
    • session.resumeWorkflow(item.getWorkflow()); session.complete(item, (session.getRoutes(item)).get(0));

choose the one that suits your use-case.

Runal_Trivedi
Runal_TrivediAccepted solution
New Participant
October 16, 2015

You will need to call workflowsession.complete to take the workflow to the next step. Resuming the workflow doesn't automatically take the workflow to next step. I know that's the weird behavior but that's how workflow resume option behaves.

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowSession.html#complete%28com.day.cq.workflow.exec.WorkItem,%20com.day.cq.workflow.exec.Route%29

Also there is a catch here, if somebody resumes the workflow from UI there it is stuck because when you trigger resume from UI it just doesn't call complete and take workflow to next step, it keeps the workflow on same step with workflow step status as complete. You can validate that from history option of workflow instance.

- Runal

smacdonald2008
New Participant
October 16, 2015

Are you passing the correct Workflow instance to the resumeWorkflow method? Are there any expections being thrown in the code? 

viveksachdeva
New Participant
October 16, 2015
Thanks.. Will try  that out... Anything about second point: workflow completes whole step even if I suspend it in the beginning of step... Is that correct/expected
Runal_Trivedi
New Participant
October 16, 2015

That's how it even works from UI workflow console, the step at which you suspend the workflow always gets completed, it won't suspend the current step and re-execute on resume.