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.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @touseefk2181136
You need :
Listener to listen changes : https://techrevel.blog/2017/03/15/resourcechangelistener/
Replication API to publish changes : https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/repli...
Hi @touseefk2181136
You need :
Listener to listen changes : https://techrevel.blog/2017/03/15/resourcechangelistener/
Replication API to publish changes : https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/repli...
@arunpatidar So I need to do following two steps ?
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.
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");
@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...
Views
Likes
Replies