I have few pages in AEM. The pages have a jcr property "replicate":"true". As soon as the replication action triggers on the page. I need to perform certain actions on the page on replicate event (like make a 3rd party api call to send the page data.) but at the same time I don't want my page to be replicated to publish instance if the replicate property is set to false.
How I can achieve this ?
Solved! Go to Solution.
Views
Replies
Total Likes
I think you can listen to the REPLICATION event and do your logic when triggered. You just need to create a new Event Listener for that, here is an example of how to do it: https://aemhints.com/2020/11/08/event-listener-in-aem-6-5/
(service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE_DESCRIPTION + "=Activation Event Listener ",
EventConstants.EVENT_TOPIC + "=" + ReplicationAction.EVENT_TOPIC
}
)
@Designate(ocd = EventListener.EventListenerPageActivationListenerConfiguration.class)
public class EventListener implements EventHandler {
..
Hi @ravir73578276 ,
Yes, it is possible with custom replication. Please check the below articles.
https://unlocklearning.in/replication-via-a-selected-replication-agent/
I think you can listen to the REPLICATION event and do your logic when triggered. You just need to create a new Event Listener for that, here is an example of how to do it: https://aemhints.com/2020/11/08/event-listener-in-aem-6-5/
(service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE_DESCRIPTION + "=Activation Event Listener ",
EventConstants.EVENT_TOPIC + "=" + ReplicationAction.EVENT_TOPIC
}
)
@Designate(ocd = EventListener.EventListenerPageActivationListenerConfiguration.class)
public class EventListener implements EventHandler {
..
Hi @ravir73578276,
You should use Preprocessor, to achieve your goal. Here are the main arguments why:
Below you can find nice article that compares workflows, event listener and preprocessor, with explanation, when to use which mechanism. It also contains simple preprocessor code
In case you would like to see more advanced example you can check this one from ACS Commons:
Views
Likes
Replies
Views
Likes
Replies