How to configure replication agent based on run modes in AEM? | Community
Skip to main content
Level 2
June 6, 2024
Solved

How to configure replication agent based on run modes in AEM?

  • June 6, 2024
  • 2 replies
  • 953 views

I need to configure a replication agent based on tun modes, such as dev, sit and staging.

How can we implement this in a simple way in AEM?

Is it possible to use a folder structure similar to OSGI configuration? 

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

Hi @nesan 
Please check this https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/replication-agent-config-group-by-runmode/td-p/235821

 

 

Create runmodes for each instance that combine the values I need, for example, my dev servers have:

  • publish, dev, d, publish-dev
  • author, dev, d, author-dev

And then I have to use the hyphenated value in my replication agents.

  • /etc/replication/agents.author-dev
  • /etc/replication/agents.publish-de

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
June 6, 2024

Hi @nesan 
Please check this https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/replication-agent-config-group-by-runmode/td-p/235821

 

 

Create runmodes for each instance that combine the values I need, for example, my dev servers have:

  • publish, dev, d, publish-dev
  • author, dev, d, author-dev

And then I have to use the hyphenated value in my replication agents.

  • /etc/replication/agents.author-dev
  • /etc/replication/agents.publish-de
Arun Patidar
HrishikeshKagne
Community Advisor
Community Advisor
June 6, 2024

Hi @nesan ,

Yes, it is possible to configure a replication agent based on run modes in AEM using a folder structure similar to OSGi configuration.

Here's a simple way to implement this:

1. Create a folder structure under `/apps` in your AEM instance to store the replication agent configurations based on run modes. For example:
```
/apps/myproject/config.publish.dev
/apps/myproject/config.publish.sit
/apps/myproject/config.publish.staging
```

2. Under each run mode folder, create a sling:OsgiConfig node with the desired replication agent configuration. For example, create a node named `com.day.cq.replication.impl.ReplicationAgentImpl-myagent.config` with the necessary properties.

3. In each run mode folder, create a `sling:OsgiConfig` node named `org.apache.sling.installer.api.tasks.ResourceTransformer.config` with the following properties:
- `service.ranking` (Integer): Set a higher value for the run mode you want to prioritize. For example, set a higher value for `config.publish.staging` if you want it to take precedence over other run modes.
- `resource.processing.priority` (Integer): Set a higher value for the run mode you want to prioritize.

4. Restart your AEM instance for the changes to take effect.

With this setup, AEM will automatically pick up the appropriate replication agent configuration based on the active run mode. The configuration under the run mode with the highest `service.ranking` value will be used.

Note: Make sure to adjust the folder structure and configuration names according to your project's needs.

Hrishikesh Kagane