AEM Replication and Reverse Replication

AEM Replication and reverse replication allows to push content from an author to publish AEM and publish to AEM author instance respectively.

Author instance generally hosted on 4502 port. This is an internal (not for end user) server mainly used for content authoring. Content will get publish or transfer to multiple AEM instances on content replication which is also called as activation.

We can have one or more than one publish AEM instance. 

Replication Agent

Replication agent is a configuration which help us to publish content from author to publish instance. It needs to be created for each publish instance.  

Follow below steps to create replication agent:

1. Navigate to below URL and select Configuration tile.

http://localhost:4502/sites.html/content

2. Traverse to Replication option which will have Agents on author and Agents on publish option.

3. Select Agents on author option and click on new to create a New Page as highlighted below red in color.

4. Select Replication Agent option, provide required custom title and click on create button. 

5. Click on Open option.

6. Check the Enabled checkbox to enable replication agent.

7. Go to transport tab and provide URI as https://<hostname>:4503/bin/receive?sling:authRequestLogin=1. 

In our case for local it will be https://localhost:4503/bin/receive?sling:authRequestLogin=1.

Fill username and password.

Click on OK button to save the changes.

8. Click on test connection will check connection in between author and publish.

9. It will show below highlighted output if connection in between author and publish instance is successful. 

Replication Using Custom API

Use com.day.cq.replication API to publish or replicate a resource.

Follow below steps for custom resource replication:

1. Use @Reference annotation to consume Replicator OSGI service 

@Reference
Replicator replicator;

2. replicate() method from Replicator interface will help us to publish content or resource as soon as we provide session, replication type and content, asset or resource path.

replicator.replicate(session, "Activate", resource_path);

Reverse Replication

AEM Publish instance generally hosted on 4503 port and available to access for end users. 

As part of reverse replication, content will get replicate or transfer from publish instance to author.

Out of the box, only cq:Page is applicable for reverse replication. For other node it require to write custom code. 

Reverse replication needs to be triggered if there is any change in the content. Add cq:lastModified, cq:lastModifiedBy, cq:distribute properties as part of an event to fire reverse replication agent. 

At the time of activation please clear cq:lastModified, cq:lastModifiedBy, cq:distribute properties to avoid infinite loop.

Reverse replication agent

Follow all above steps we wrote as part of replication agent section to create a reverse replication agent except 4th step. 

As part of 4th step please select Reverse Replication Agent and provide Title as shown below.

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan