How to call flush agent programmatically for flushing referenced page
Hi All,
As part of flushing referenced pages, we have to call flush agent programmatically to flush each referenced page for scaffolding content.
Scaffolding content is added in different pages and cache invalidation has to be happen for all referenced pages whenever scaffolding content page has to replicated from author to publish.
I tried the below API to call flush agent similar to calling normal replication agent for publishing content from author to publish. It is invoking flush agent.
ReplicationOptions opts = new ReplicationOptions();
opts.setSuppressVersions(true);
opts.setSuppressStatusUpdate(true);
AgentIdFilter agentIdFilter = new AgentIdFilter("flush");
opts.setFilter(agentIdFilter);
replicator.replicate(session, ReplicationActionType.ACTIVATE, action.getPath(), opts);
Not sure whether it is proper way to do it ? Is there any other way to call flush agent programmatically ?
I don't want to flush each page by using CURL or PostMethod method call.
PostMethod post = new PostMethod("http://localhost:80/dispatcher/invalidate.cache");
post.setRequestHeader("CQ-Action", "Activate");
post.setRequestHeader("CQ-Handle",handle);