Update and publish DAM file, each specific time | Community
Skip to main content
September 6, 2021
Solved

Update and publish DAM file, each specific time

  • September 6, 2021
  • 2 replies
  • 1050 views

Greetings,
I have a task to get, each 2 hours, some informations SAP and create or update, a file in DAM. But, i need to replicate, too. How to do this? How can i replicate(publish) this DAM file each 2 hours? My enviroments do not have "DAM Update Asset".

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ibishika

You can use the Replication API to take care of the replication. You will have to write custom code. Check this post: https://helpx.adobe.com/experience-manager/using/aem64_replication_api.html

To run this every 2 hours make use of Scheduler. https://www.adobe.io/experience-manager/reference-materials/6-4/javadoc/org/apache/sling/commons/scheduler/Scheduler.html

2 replies

ibishika
ibishikaAccepted solution
Level 4
September 6, 2021

You can use the Replication API to take care of the replication. You will have to write custom code. Check this post: https://helpx.adobe.com/experience-manager/using/aem64_replication_api.html

To run this every 2 hours make use of Scheduler. https://www.adobe.io/experience-manager/reference-materials/6-4/javadoc/org/apache/sling/commons/scheduler/Scheduler.html

thionorAuthor
September 6, 2021

Thanks @ibishika 
I will see this article!

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 6, 2021

Given your scenario, I would do something like this:

 

You can create a designated folder like /content/dam/my-site/automagic

 

This folder will be watched by the AEM OSGI Event Hander, org.osgi.service.event.EventHandler. for both EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/ADDED", EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/CHANGED" where a the assets JCR_CONTENT node's properties will be updated with something like "pendingAutomaticReplication=true";

 

Next, Using the scheduler, https://www.adobe.io/experience-manager/reference-materials/6-4/javadoc/org/apache/sling/commons/scheduler/Scheduler.html, you can use the JCR_SQL2 query strings to find all assets that has pendingAutomaticReplication=true; and replicate each asset every 2 hours. Dont forget to change pendingAutomaticReplication=false;

 

Regards,

Brian.