How to push a node from author to publish in real time on Adobe Cloud ? | Community
Skip to main content
touseefk2181136
New Participant
August 7, 2024
Solved

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

  • August 7, 2024
  • 3 replies
  • 1168 views

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.

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

3 replies

Harwinder-singh
New Participant
August 7, 2024

@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/replication#replication-api

 

 

Employee
August 7, 2024

@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");
arunpatidar
arunpatidarAccepted solution
New Participant
August 7, 2024
touseefk2181136
New Participant
August 7, 2024

@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 ) ?
arunpatidar
New Participant
August 7, 2024

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