Hi,
After starting a workflow with wfSession.startWorkflow(wfModel, wfData); how can i wait the end of it before the return value?
I'm not able to find the correct function.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
this approach is not going to work well. Because it is not guaranteed that it will finish within that time. Why do want to run the activity as workflow if the user needs to wait anyway for the termination if this process?
kind regards,
Jörg
Views
Replies
Total Likes
Hi Sam,
If you know the exact time that will take to execute your workflow, then one way of achieving is using "Thread.sleep(<time in millisecond>)" in your current process. Is that possible to provide exact use case?
Thanks
Views
Replies
Total Likes
what is the usecase ?? It depends on how you are using it
Views
Replies
Total Likes
I agree with Lokesh - waiting for a workflow to end all depends on the model. If you have a lot of steps and participants - it will take longer then if its a smaller model that say for example - deletes JCR node content.
If you requirement is to figure out how long a workflow takes - you can write a custom step that starts a counter when when the workflow starts (a thread that counts) and calls another custom step that stops the counter. Then calculate the time.
Views
Replies
Total Likes
I have a user interface with a button, when the user clicks this button he starts a workflow.
The entire workflow take about 30 seconds / 2 minutes then i need an alert for the user.
Workflow wfInstance = wfSession.startWorkflow(wfModel, wfData); while(wfInstance.isActive()){ log.info("status:"+wfInstance.getState()); Thread.sleep(5000); }
This code prints every 5 seconds the string: status:RUNNING
With the InBox interface i terminate the running instance but in the log i see again: status:RUNNING with an endless loop.
Views
Replies
Total Likes
It depends on your workflow model. Does your workflow model has any participant steps ??
Once you start the workflow programmatically, also check the workflow instance and it status in the console (libs/cq/workflow/content/console.html)
Views
Replies
Total Likes
Hi,
this approach is not going to work well. Because it is not guaranteed that it will finish within that time. Why do want to run the activity as workflow if the user needs to wait anyway for the termination if this process?
kind regards,
Jörg
Views
Replies
Total Likes
Only default step + process step (This process has only a print to console).
I can complete correctly the workflow but the log has ever the string status:RUNNING
Views
Replies
Total Likes
ook.. Have you made sure to check 'Handle Advance' check box in your process step ? Unless that it doesnt completes the workflow !
Views
Replies
Total Likes
I have already checked this checkbox.
The workflow end correctly, it is the code above that doesn't work. It seems that the variable isn't refreshed.
Views
Replies
Total Likes
When you say workflow end correctly, did you check if the instances are not present in the console ??
Also, are you seeing any error messages in the log ?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies