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?
Solved! Go to Solution.
Views
Replies
Total Likes
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).
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 -
I could see com.day.cq.replication.Agent has following method: isInMaintenanceMode()
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.
@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.
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).
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 -
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()));
}
}
}
}
Referred api : https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/constant-values.html#...
Great explanation @DEBAL_DAS .
This helps. Thank you @DEBAL_DAS
Views
Likes
Replies