Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to wait until Dam Update asset workflow completes

ravir73578276
Level 1
Level 1

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.

1 Accepted Solution
Peter_Puzanovs
Correct answer by
Community Advisor
Community Advisor

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/co... 

 

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 

View solution in original post

4 Replies
Arun_Patidar
Community Advisor
Community Advisor

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.

Peter_Puzanovs
Correct answer by
Community Advisor
Community Advisor

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/co... 

 

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 

ravir73578276
Level 1
Level 1
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.
Peter_Puzanovs
Community Advisor
Community Advisor
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.