Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to get page's content info before replication(DELETE)?

Avatar

Level 3

I need to collect some info from page properties and child nodes properties befor replication(delete) occurs

If i implement EventHandler 

@Component(immediate = true) @Service @Property(name = EventConstants.EVENT_TOPIC, value = ReplicationAction.EVENT_TOPIC) public class RedisVideoUpdaterService implements EventHandler { .................. public void handleEvent(Event event) { ReplicationAction action = ReplicationAction.fromEvent(event); ReplicationActionType actionType = action.getType(); if (actionType.equals(ReplicationActionType.DELETE)) { //process data collecting } ...............

After `handelEvent` triggered there page is already deleted.

If i implement Preprocessor:    

@Component(immediate = true) @Service public class RedisVideoUpdaterService implements Preprocessor{ .................. public void preprocess(ReplicationAction action, ReplicationOptions replicationOptions) throws ReplicationException { ReplicationActionType actionType = action.getType(); if (actionType.equals(ReplicationActionType.DELETE)) { //process data collecting } ...............

`preprocess` method is not triggered at all on delete action.

Both cases are OK for actiovation/deactivation.

How can I process page before it have been deleted?

1 Accepted Solution

Avatar

Correct answer by
Level 3

As I noticed. Preppocessor triggered on delete only for activated pages. This behaviour is ok for me.

View solution in original post

3 Replies

Avatar

Level 10

I would explore the workflow route. Write a workflow that perform the action you want. THen write a custom step to get the workflow item (page) and then read the props before performing the replicate or delete action, 

Avatar

Level 3

I configured Custom Workflow via Workflow Launcher Configuration on 'removed' Event type. Result the same as for first case.

Workflow executed after page has been deleted.

Avatar

Correct answer by
Level 3

As I noticed. Preppocessor triggered on delete only for activated pages. This behaviour is ok for me.