2

In CQ5, 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?

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55
dzenisiy
  • 855
  • 10
  • 32
  • 1
    I have done something of this sort and the preprocessor implementation should work. are you using a custom replicator? you may want to debug line by line to see whats happening. – awd Feb 19 '16 at 05:21

1 Answers1

0

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

dzenisiy
  • 855
  • 10
  • 32