Adobe Consulting Services AEM Commons open source library. The service is based on the code we implemented at a client which reduced the execution time of their _that job_by approximately 50%. In this case, that job was importing content from an internal data source to create a large number of pages on the website. It then performed a tree activation on the content to get it from Author to the Publishers. This would take hours and had the occasional tendency to take down a server as it would get overloaded with the thousands of replication events.
Instead of relying on tree activation, we switched over to package replication. This cut the replication time from hours to minutes and eliminated the performance issues.
Based on this tremendous performance improvement, I developed a new, genericized service for AEM ACS Commons. The new feature in ACS AEM Commons, Automatic Package Replication allows you to automatically build and replicate a package on a schedule, as a part of a workflow or through a Sling Event.
Incorporating the Automatic Package Replication service in your that job is a pretty simple trick. Let’s assume you want to fire replication after your job completes. You’d just follow these steps:
3. Navigate to the Automatic Package Replication configuration and create a new configuration 4. Set the Trigger to “Sling Event” and the Event Topic to a unique value for your job. If you have multiple different packages your job may replicate or multiple instances of the job, you can use the Event Filter to further limit when the package will be replicated.
5. Add the code into your job to fire off a Sling, for example:
@Reference
private EventAdmin eventAdmin;
[... more code ...]
final Event event = new Event("customer/app/job1-replicate", new HashMap<String, String>() {
private static final long serialVersionUID = 1L;
{
put("package", "my-package");
}
});
eventAdmin.postEvent(event);
This will trigger the Automatic Package Replicator configuration you defined to run which will build the package and replicate it to the publisher servers.
For more information on the Automatic Package Replication service, consult the documentation on the ACS AEM Commons website. If you have any questions, leave a comment or drop me a line!