All AEM 6.5 LTS skills: Workflow model design, development, triggering, launchers, debugging, and triaging; Dispatcher config authoring, advisory, incident response, performance tuning, and security hardening; Replication agent configuration, content activation, API usage, and troubleshooting for AEM 6.5 LTS and AMS environments; Jackrabbit Oak query/index tuning (property, Lucene index definitions); and extracting/inventorying JCR queries (XPath, SQL2, QueryBuilder) across a codebase.
79%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Programmatic replication via the AEM Java API or HTTP endpoint.
import com.day.cq.replication.Replicator;
import com.day.cq.replication.ReplicationActionType;
import com.day.cq.replication.ReplicationException;
import javax.jcr.Session;
import org.apache.sling.api.resource.ResourceResolver;
@Reference
private Replicator replicator;
public void activate(ResourceResolver resolver, String path) throws ReplicationException {
replicator.replicate(resolver.adaptTo(Session.class), ReplicationActionType.ACTIVATE, path);
}
public void deactivate(ResourceResolver resolver, String path) throws ReplicationException {
replicator.replicate(resolver.adaptTo(Session.class), ReplicationActionType.DEACTIVATE, path);
}| Type | Effect |
|---|---|
ACTIVATE | Publish to Publish instances |
DEACTIVATE | Remove from Publish instances |
DELETE | Permanently delete from Publish |
TEST | Test agent connectivity only |
REVERSE | Reverse replicate (Publish → Author) |
import com.day.cq.replication.ReplicationOptions;
import com.day.cq.replication.AgentFilter;
ReplicationOptions opts = new ReplicationOptions();
opts.setSynchronous(true); // wait for completion before returning
opts.setSuppressVersions(true); // skip version creation
opts.setFilter(agent -> agent.getId().equals("publish")); // target specific agent
replicator.replicate(session, ReplicationActionType.ACTIVATE, path, opts);curl -s -u "$AEM_USER:$AEM_PASSWORD" -X POST \
http://localhost:4502/bin/replicate.json \
-F "cmd=Activate" \
-F "path=/content/mysite/en/page"
# ✓ Verify: HTTP 200, response body {"success":true,"path":"/content/mysite/en/page"}curl -s -u "$AEM_USER:$AEM_PASSWORD" -X POST \
http://localhost:4502/bin/replicate.json \
-F "cmd=Deactivate" \
-F "path=/content/mysite/en/page"
# ✓ Verify: HTTP 200, response body {"success":true}curl -s -u "$AEM_USER:$AEM_PASSWORD" -X POST \
http://localhost:4502/etc/replication/treeactivation.html \
-F "path=/content/mysite/en" \
-F "onlyModified=true"
# Note: returns HTML — check for "successfully" in response body
# ✓ Verify: HTTP 200 and no error text in responseresponse=$(curl -s -w "\n%{http_code}" -u "$AEM_USER:$AEM_PASSWORD" -X POST \
http://localhost:4502/bin/replicate.json \
-F "cmd=Activate" -F "path=/content/mysite/en/page")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
[ "$http_code" -eq 200 ] || { echo "Failed: HTTP $http_code — $body"; exit 1; }
echo "$body" | grep -q '"success":true' || { echo "Replication error: $body"; exit 1; }Use a dedicated service user (not admin) in OSGi components. Create an OSGi config file:
// org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-replication.cfg.json
{
"user.mapping": [
"com.example.bundle:replication-service=replication-service-user"
]
}Grant the service user jcr:read on the content path and crx:replicate privilege.
For a complete API reference (ReplicationStatus, AgentManager, ReplicationQueue, ReplicationListener), see the replication-api skill.
.tessl-plugin
skills
aem-replication
aem-workflow
dispatcher
ensure-agents-md
references
tuning-oak-query-indexes