How to wait until Dam Update asset workflow completes | Community
Skip to main content
ravir73578276
Level 3
April 28, 2021
Solved

How to wait until Dam Update asset workflow completes

  • April 28, 2021
  • 2 replies
  • 2183 views

I am using a servlet to upload images programatically through asset manager api into dam and its renditions will be created by dam update asset workflow. In the servlet response I need to return the urls of all the generated renditions for the UI to consume.Now since the rendition generation will take time, as dam update asset workflow takes time to start and to complete, how to ensure that my servlet sends the response only after all the renditions are completely generated? Note:- I am using ImageMagic for generating renditions via dam update asset workflow.

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 Peter_Puzanovs

Dear Ravi,

 

You can invoke Workflow API getStatus[1] to get the status of your workflow. 

 

[1] https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/adobe/granite/workflow/exec/Workflow.html#getState-- 

 

You can then write Java code to check for the status of workflow. Make sure to include number of maximum retries to avoid infinitely blocked threads in your AEM instance.


Regards,

Peter 

2 replies

arunpatidar
Community Advisor
Community Advisor
April 28, 2021

you need to wait and do check periodically using Thread and check the status of the dam assets, PROCESS, COMPLETE and then return the URLs.
Please make sure you handling the thread and kill after sometime if dam process is stcuk.

Arun Patidar
Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
April 28, 2021

Dear Ravi,

 

You can invoke Workflow API getStatus[1] to get the status of your workflow. 

 

[1] https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/adobe/granite/workflow/exec/Workflow.html#getState-- 

 

You can then write Java code to check for the status of workflow. Make sure to include number of maximum retries to avoid infinitely blocked threads in your AEM instance.


Regards,

Peter 

Peter_Puzanovs
Community Advisor
Community Advisor
April 30, 2021
Specify wait and keep retrying for a number of rounds till you either run out of maximum number of retries or get a COMPLETED status from the Workflow API.