How to wait until Dam Update asset workflow completes | Community
Skip to main content
ravir73578276
Level 3
Apr 28, 2021 9:13 AM UTC
Solved

How to wait until Dam Update asset workflow completes

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.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Apr 28, 2021 11:19 AM UTC

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 

4 replies

Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Apr 28, 2021 11:19 AM UTC

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 

Translate
ravir73578276
Level 3
Apr 28, 2021 12:10 PM UTC
I am not sure ,If I will get the status of dam update asset workflow as active instantly because workflow will take some time to start. So , i think i need to wait for few millisecs time after invoking the createAsset Method to invoke the workflow api to get its status.. but will it be ideal to do so , as there is no such fixed waiting time. Please correct me if I am wrong.
Translate
arunpatidar
New Participant
Apr 28, 2021 10:09 AM UTC

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.

Translate
Arun Patidar