Expand my Community achievements bar.

SOLVED

Replication Agent maintenance Mode

Avatar

Level 2

What is the use of putting your Replication Agent to maintenanceMode=true while certain activities like Asset Moves are running on your AEM server?

What exactly does the maitenanceMode=true do?

@Jörg_Hoh @arunpatidar Have you come across usage of this property?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

If you have the maintenance mode enabled for an agent, this agent is no longer considered when checking the replication status. That means it still delivers content, but you don't see pending replication (e.g. in Classic UI's siteadmin) even if this queue is full, but the others are not.

 

it is mostly used if the authors should not care about the queue size of an agent, e.g. because you are performing a time-consuming maintenance on a publish system, which is not reachable from enduser (and when thus a growing replication queue doesn't matter until the system is being put back into service).

View solution in original post

7 Replies

Avatar

Employee Advisor

I have got following article https://rashidjorvee.blogspot.com/2020/08/pause-option-in-aem-replication-agent.html and here it is mentioned "At some point we need to stop the replication from AEM author to publisher for sometime or few minutes, so that no content get published from author to publisher instance. This may we need to handle the maintenance window or stop accepting new content from authors."

 

But this pause didn't put replication agent in maintenance mode[clearly highlighted in above article] or set any property called maintenance in JCR -

 

DEBAL_DAS_0-1646973435948.png

I could see com.day.cq.replication.Agent has following method: isInMaintenanceMode()

Wrote this sample servlet to read enabled agents -

package com.aem.demo.core.servlets;

import java.io.IOException;

import javax.servlet.Servlet;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.HttpConstants;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.day.cq.replication.Agent;
import com.day.cq.replication.AgentManager;

@component(service = Servlet.class, property = { "sling.servlet.paths=" + "/bin/agentDetails",
"sling.servlet.methods=" + HttpConstants.METHOD_GET })
public class AgentDetailsServlet extends SlingAllMethodsServlet {


@reference
AgentManager agentManager;

/**
*
*/

private final Logger logger = LoggerFactory.getLogger(AgentDetailsServlet.class);

protected void doGet(SlingHttpServletRequest slingHttpServletRequest,
SlingHttpServletResponse slingHttpServletResponse) throws IOException {

for (Agent agent : agentManager.getAgents().values()) {
if (agent.isEnabled()) {

logger.info("**** Agent Details ****{}", agent.getId());
logger.info("**** Agent Details ****{}", agent.getConfiguration().getName());
slingHttpServletResponse.getWriter().write(agent.getId().concat("****************").concat(agent.getConfiguration().getName()));

}


}
}

}

 

 

I will explore this functionality and keep you posted.

Avatar

Level 2

@DEBAL_DAS Thanks for your time and effort, this suggestion was indeed provided by Adobe Day care team for one of our tickets. But we couldn't find any documentation related to it in helpX or other blogs.
So wanted to understand this feature what they suggested. We have also replied back to them with more info in parllel. But wanted to check if anyone else has come across this scenario where we put Agents in Maintenance mode.

Avatar

Correct answer by
Employee Advisor

If you have the maintenance mode enabled for an agent, this agent is no longer considered when checking the replication status. That means it still delivers content, but you don't see pending replication (e.g. in Classic UI's siteadmin) even if this queue is full, but the others are not.

 

it is mostly used if the authors should not care about the queue size of an agent, e.g. because you are performing a time-consuming maintenance on a publish system, which is not reachable from enduser (and when thus a growing replication queue doesn't matter until the system is being put back into service).

Avatar

Employee Advisor

Thanks for your explanation.

 

@bnagesh and @Jörg_Hoh , Earlier I made a mistake in my curl command associated with maintenanceMode property name [plz accept my apology].

 

Here is the correct curl command to create a replication agent and put in on maintenanceMode -

curl -u admin:admin -X POST -F "jcr:primaryType=cq:Page" -F "jcr:primaryType=nt:unstructured" -F "jcr:content/jcr:title=Replication Agent2" -F "jcr:content/sling:resourceType=cq/replication/components/agent" -F "jcr:content/cq:template=/libs/cq/replication/templates/agent" -F "jcr:content/logLevel=info" -F "jcr:content/retryDelay=60000" -F "jcr:content/serializationType=durbo" -F "jcr:content/transportUri=http://localhost:4503/bin/receive?sling:authRequestLogin=1" -F "jcr:content/jcr:description=Agent that replicates to the default publish instance." -F "jcr:content/transportUser=admin" -F "jcr:content/transportPassword=admin" -F "jcr:content/maintenanceMode=true" http://localhost:4502/etc/replication/agents.author/publish2

 

I have noticed maintenanceMode=true makes the agent disable as shown below -

 

DEBAL_DAS_0-1647074390420.pngDEBAL_DAS_1-1647074475518.png

 

Now the below servlet is giving expected agent name -

package com.aem.demo.core.servlets;

import java.io.IOException;

import javax.servlet.Servlet;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.HttpConstants;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.day.cq.replication.Agent;
import com.day.cq.replication.AgentManager;

@Component(service = Servlet.class, property = { "sling.servlet.paths=" + "/bin/agentDetails",
"sling.servlet.methods=" + HttpConstants.METHOD_GET })
public class AgentDetailsServlet extends SlingAllMethodsServlet {


@Reference
AgentManager agentManager;

/**
*
*/

private final Logger logger = LoggerFactory.getLogger(AgentDetailsServlet.class);

protected void doGet(SlingHttpServletRequest slingHttpServletRequest,
SlingHttpServletResponse slingHttpServletResponse) throws IOException {

for (Agent agent : agentManager.getAgents().values()) {
if (agent.isInMaintenanceMode()) {

logger.info("**** Agent Details ****{}", agent.getId());
logger.info("**** Agent Name ****{}", agent.getConfiguration().getName());
slingHttpServletResponse.getWriter().write(agent.getId().concat("****************").concat(agent.getConfiguration().getName()));

}

DEBAL_DAS_2-1647074610137.png

 



}
}

}

Referred api : https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/constant-values.html#...