Expand my Community achievements bar.

SOLVED

Update and publish DAM file, each specific time

Avatar

Level 1

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".

1 Accepted Solution

Avatar

Correct answer by
Level 6

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

View solution in original post

3 Replies

Avatar

Correct answer by
Level 6

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

Avatar

Community Advisor

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