Последнее обновление
21 мая 2021 г.
Question
How do I programmatically activate pages to only certain replication agents?
Answer, Resolution
You can create a ReplicationOptions [2] object with an AgentFilter [2]:
ReplicationOptions opts = new ReplicationOptions();
opts.setFilter(new AgentFilter(){
public boolean isIncluded(final Agent agent) {
return "expectedAgentId".equals(agent.getId());
}
});
then use the Replicator"s [3] replicate method:
/**
* Triggers a new replication with supplied options.
*
* @param session user session
* @param type The type of replication
* @param path The path specified the content to be replicated
* @param options Additional replication options
* @throws ReplicationException if an error occurs
*/
void replicate(Session session, ReplicationActionType type, String path,
ReplicationOptions options)
Applies to
CQ5.x
References
[1] http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/replication/ReplicationOptions.html
[2] http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/replication/AgentFilter.html
[3] http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/replication/Replicator.html
Other Related Articles: