Hi All,
I am new to replication topic. I need few guidance here, where i worte one pseudo code. I have to deactive the list of pages through replicator api in a workflow in AEM6.5, but only if the objects in replication queue will be less than 500, means we're restricting to avoid load on replication agent incase if we're having more than 500 pages in replication queue then our workflow will not trigger or execute and show error message to author
reading the replication objects from
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish1india
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish2china
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish1japan
@Override
public void execute (WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws
WorkflowException {
String payload = workItem.getWorkflowData().getPayload().toString();
if (rootPage != null && replicationQueueChechk()) {
replicator.replicate(session, ReplicationActionType.DEACTIVATE, paths, replicationOptions);
//code goes here...
}
}
private boolean replicationQueueChechk () {
//TODO check the number of active objects in replication queue, return true only if replication queue is less than 500, otherwise return false
}
How to restrict this and avoid triggring the workflow, or let me know if there is any optimize way to achieve this
Thanks
cc: @kautuk_sahni @arunpatidar @lukasz-m @VeenaVikraman @Jagadeesh_Prakash
Views
Replies
Total Likes
@Marcos_aem Once check below link for custom implementation
https://kiransg.com/tag/bulk-replication/
The cause of this issue is the org.apache.sling.event.impl.JobEventHandler has a default limit of 10 on the number of job queues that the system can create.
Resolution
Increase the maximum number of Job queues as needed (the number of queues should be higher than the number of configured replication agents + number of workflow models)
For more information, see http://helpx.adobe.com/experience-manager/kb/CQ53UnableToCreateJobQueueDueToMaxQueues.html.
https://helpx.adobe.com/experience-manager/kb/experience-manager-replication-faqs.html
Hi @Marcos_aem
Yes, there is an easy way for it.
private boolean replicationQueueChechk (Session session) {
ReplicationQueue replicationQueue = Replication.getQueue(resourceResolver.adaptTo(session.class)); List<ReplicationQueueEntry> queueEntries = replicationQueue.entries();
if (queueEntries.size() < 500) {
// If yes, then deactivate the pages
} else {
//some message
}
}
Thank you @Anmol_Bhardwaj ,
I am just wondering if this will work for our custom created replication agent?
like as I mentioned I need to monitor the queue before seding for activate/deactivate.
which let say I can check from CRX under nodes example:
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish1india
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish2china
/var/eventing/jobs/assigned/212-212-212-hashcode/com.day.cq.replication.job.publish1japan
so will the above api will take care of this or need to create a custom one?
You need to check number of entries in the queue.
Check https://javadoc.io/static/com.adobe.aem/aem-sdk-api/2023.4.11873.20230421T153841Z-230200/com/day/cq/... for more details.
Views
Likes
Replies
Views
Likes
Replies