Expand my Community achievements bar.

SOLVED

EventHandler vs Preprocessor

Avatar

Level 4

Would like to ask what the difference between EventHandler vs Preprocessor?
We have a use case that certain property would be added in case there would be a publish action. Currently, it is applied to an event handler, and it seems that this properties were intermittently applied, whereas there is another property we added on preprocessor, and seems to be working fine.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @LyonMartin ,

EventHandler are fired asynchronously and hence orders are not maintained.

Also it doesn't notify if the event action completed successfully, as well as it doesn't guarantee completion.

 

Pre-processor have following advatages-

  • this is part of AEM replication api, and has dedicated entry point which run just before replication is triggered always
  • do not need to create any additional replication agents or configurations
  • as this is part of replication flow, it is guarantee it will be run, unlike event listener you do not have to worry if you have picked up appropriate event topic, or if the event will be blacklisted etc
  • it gives you information about replication action type (e.g. Activation, Deactivation etc), path and others
  • finally it allows you to stop replication process

https://dileepakv.blogspot.com/2018/01/aem-replication-preprocessor.html

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/replicatio....

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adob...

Thanks

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @LyonMartin ,

EventHandler are fired asynchronously and hence orders are not maintained.

Also it doesn't notify if the event action completed successfully, as well as it doesn't guarantee completion.

 

Pre-processor have following advatages-

  • this is part of AEM replication api, and has dedicated entry point which run just before replication is triggered always
  • do not need to create any additional replication agents or configurations
  • as this is part of replication flow, it is guarantee it will be run, unlike event listener you do not have to worry if you have picked up appropriate event topic, or if the event will be blacklisted etc
  • it gives you information about replication action type (e.g. Activation, Deactivation etc), path and others
  • finally it allows you to stop replication process

https://dileepakv.blogspot.com/2018/01/aem-replication-preprocessor.html

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/replicatio....

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adob...

Thanks