Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM 6.4 : Replicate content to a different folder

Avatar

Level 4

Hello All, I am looking to see if there is an option to publish the content from author to a different path in the receiving end.

Eg: Path in author:

/content/dam/xyx/logo/logo.jpg

/content/dam/xyx/image/img.jpg

    

This could be published to the received to the folders(in bold)

/content/dam/xyx/logo/logo.jpg --> /content/dam/public/xyx/logo/logo.jpg

/content/dam/xyx/image/img.jpg --> /content/dam/protected/xyx/image/img.jpg

My replication will  be a process step in a workflow. Is this doable?

Regards,

Anand

3 Replies

Avatar

Community Advisor

Hi,

Check below link which has same question and solution

Replicating a CQ page to two different paths in CQ publisher

After replicating you can deactivate programmatically actual path if needed.

Avatar

Level 10

You can use the AEM Replication API to build workflows. See this HELPX article:

Adobe Experience Manager Help | Replicating Adobe Experience Manager Content using the Replication A...

If you look at the API call - you can define the path:

//Inject a ResourceResolver - make sure to whitelist the bundle

    Session session = wfsession.adaptTo(Session.class);

    ResourceResolver resourceResolver = resolverFactory.getResourceResolver(Collections.singletonMap("user.jcr.session", (Object) session)); 

        

    // Create leanest replication options for activation

    ReplicationOptions options = new ReplicationOptions();

    // Do not create new versions as this adds to overhead

    options.setSuppressVersions(true);

    // Avoid sling job overhead by forcing synchronous. Note this will result in serial activation.

    options.setSynchronous(true);

    // Do NOT suppress status update of resource (set replication properties accordingly)

    options.setSuppressStatusUpdate(false); 

    log.info("**** ABOUT TO REPLICATE" ) ; 

    //Rep the content      replicate(Session session, ReplicationActionType type, String path)

    replicator.replicate(session,ReplicationActionType.ACTIVATE,path);

Hope this helps you!

Avatar

Level 4

Hello Scott, Thanks for the reply.

I am aware of using Replication API in workflow and I have been using that. The problem that I am trying to solve is how to take the content from Author to a different path in Publisher.

So as mentioned in the link,Replicating a CQ page to two different paths in CQ publisher   is a custom Transport handler the only option for this.

Regards