Hello All,
Our project is being run on AEM 6.1 with SP1 service pack.
Content authors are uploading the assets in bulk and after asset upload, they open each image and set few custom metadata(ex: asset expiration date).
We have created a custom workflow for setting these custom metadatas.
We have configured workflow launcher to trigger this custom workflow (both on node:created and node:modified events)
The issue we are facing here is : When user updates some metadata on image, dam-xmp-writeback workflow will be triggered (as it is configured in workflow launcher for node:modified event), at the same time our custom workflow is also triggered.
Hence, for few assets, we are getting this exception javax.jcr.version.VersionException: Cannot set property. Node is checked in. since both the workflows will be trying to act upon the same payload (/content/dam/*/assetname/jcr:content/metadata), and one of them will lock it and another won't get the resource at the same time.
Our business logic was written such that, if we get any such exception in the workflow process step, we are removing the metadata node for that asset.
Say Suppose we upload some 10 images, 2-3 images are having this issue and their metadata nodes are getting removed, and authors are reporting that they are not able to open those images and edit them anymore(this is obvious since there is no metadata node for them).
Now please suggest a way to handle this,
Is there a way to avoid this version exception ? or should we modify the code such that we won't remove metadata node in exception scenario?
Is it ok to disable xmp-writeback workflow on node:modified event?
What would be the best way to handle this issue?