Développer ma barre des réalisations de la Communauté.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
RÉSOLU

How to push a node from author to publish in real time on Adobe Cloud ?

Avatar

Level 3

I am working on AEM project to be deployed on Adobe cloud. I have a requirement that whenever a store data node of nt:unstructured type say "store1" on the path /content/data/stores/store1 is created in JCR on author, it should be pushed on publish instance as well automatically. I guess we can use sling content distribution (forward distribution) to achieve this ? Do I need to write any code to sync these changes from author to publish in real time ?
For example this is how I am saving a node on author using a servlet

 

Node rootNode = session.getNode("/content/data/stores");
storeNode = rootNode.addNode(storeId, "nt:unstructured");
// Set created date
Calendar created = Calendar.getInstance();
storeNode.setProperty("jcr:created", created);

Now I want to this new store node to be available on publish instance too in real time. Kindly guide regarding this.

Sujets

Les sujets facilitent la catégorisation du contenu de la Communauté et vous aident à retrouver le contenu le plus pertinent.

1 solution acceptée

Avatar

Réponse correcte par
Community Advisor
5 Replies

Avatar

Réponse correcte par
Community Advisor

Avatar

Level 3

@arunpatidar So I need to do following two steps ? 

  1. Listener to listen changes (Will it work on adobe cloud)
  2. Use Replication API (I need to use replication API code in my servlet to push node changes from author to publish ) ?

Avatar

Community Advisor

Hi @touseefk2181136 
If you are creating those nodes using servlet then you don't need Listener then you can use Replication API to replicate node.

 

Arun Patidar

AEM LinksLinkedIn

Avatar

Employee

@touseefk2181136 

Since you are creating the node programatically on author, you can even publish it from author to publisher in code itself using replication api

replicator.replicate(session, ReplicationActionType.ACTIVATE, "your_path");

Avatar

Community Advisor

@touseefk2181136  You need to add the below after setting the node properties.

 

replicator.replicate(session, ReplicationActionType.ACTIVATE, "/content/data/stores");

 

Ofcourse, make sure that you add the Replicator service in your service by using : 

@Reference
    private Replicator replicator;

More on the replication API - https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/repli...