How to trigger Workflow on Assets after Dynamic Media upload
AEM has provided an OOTB “Scene7 Batch Upload” step that now uploads assets to Dynamic media in batches. This was done to optimize the performance and prevent bottleneck when huge load of assets is being ingested and processed at AEM DAM.
Now with this change a use case came up as to how do we trigger workflow on assets that have been uploaded to dynamic media. For example let’s say we ingested assets and processed them using the OOTB batch upload process to dynamic media, after its been processed we want to send the generated dynamic media URL (from asset metadata) to an external system where it will be used for some business process. The catch here is since its being done in batches we cannot do it in the same workflow model, we need a way to monitor this batch process and pick each assets as it gets processed to dynamic media.
So now let’s understand the solution for this particular use case. AEM has introduced a new workflow model called “Batch Thumbnails”, this workflow is linked to a workflow launcher as seen in below snapshot.
Mainly what happens is when OOTB batch process uploads assets to dynamic media it creates a node under “/var/dam/pending-thumbs” for each asset that gets processed. Now the above workflow launcher gets triggered for each node and updates the asset thumbnail and post processing it deletes the respective node.
So this is the point where we can hook up any custom workflow step. The most standard approach will be to create a new workflow model which is a copy of “Batch Thumbnails” model and then add custom workflow steps to handle any use case where we need the dynamic media URL of the assets. Then modify the workflow launcher (we discussed above) to point to this new workflow model.
Please note: This article and its approach is based on my learnings and no way to be considered an official best practice. There can always be different ways to solve things.
