Expand my Community achievements bar.

SOLVED

How to wait until Dam Update asset workflow completes

Avatar

Level 3

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

Avatar

Correct answer by
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

Avatar

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.



Arun Patidar

Avatar

Correct answer by
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 

Avatar

Level 3
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.

Avatar

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.