Like any other tools or applications we always consider maintenance word with utmost importance for AEM also.
We have seen so many great articles on AEM maintenance but here I would like to talk about maintenance mode associated with AEM Replication agent.
If we take a look at com.day.cq.replication.Agent , it has one method called: isInMaintenanceMode() and it describes “Checks if the agent is in maintenance mode”.
But most of us we don’t talk about the usage of this method.
Recently I was part of one technical discussion and got an opportunity explore this method.
The ask was: What exactly does the maintenanceMode=true do?
Here is significance of having maintenance mode enabled for an agent [explained beautifully by Adobe AEM architect]-
“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 end user (and when thus a growing replication queue doesn’t matter until the system is being put back into service).”
If we want to set the maintenance mode while creating the replication agent then we can use below curl command -
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
Initially this command will put the replication agent disable state and set the maintenanceMode=true at JCR
I think the blog needs some clarification: From the article: “If you have the maintenance mode enabled for an agent, this agent is no longer considered when checking the replication status." - that is not accurate. A large replication queue can result in AEM UI slowness. The reason is a query that AEM uses to update some interfaces. For the AEM TouchUI in Page Column View, it prints the item number in the replication queue. In any other view, that information is not available and that query has no real use. The maintenanceMode stops that queue. It does not affect the replication agent status.
From the article: "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." The best and recommended practice is to use the AEM Touch UI. With out without the maintenanceMode, the replication queue is still visible within the replication agent UI.