Expand my Community achievements bar.

SOLVED

Replication Preprocessor not working in Publisher

Avatar

Community Advisor

Hello @kautuk_sahni ,

 

We are trying to create a Replication Preprocessor in AEM Publisher which should execute for Activate and Deactivate and Fire an API call if the page is deactivated with Page Path and Page Template, as this api has to be called only for few templates. We are able to execute it successfully but we are unable to get hold of resource as it is already deactivated while this preprocessor is executed. We need resource details as we need to check with if the item is Page or Asset and get template name if that is Page.

 

Any thoughts will be appreciated or please help me in connecting with appropriate members if in case.

 

Thanks 

 

Shashi

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Correct answer by
Community Advisor

Are you using event handler? If yes then check https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ReplicationEvent2.java



Arun Patidar

Avatar

Community Advisor
No Arun, but if we use Event Handler, what is the use of Replication Pre-Processor?

Avatar

Community Advisor

Hi, you can write an event handler on node deleted. Event handler holds the state of the page in session and from there you can extract the page details. Within listener you can check the page and page template and fire API.

https://github.com/arunpatidar02/aem63app-repo/blob/2d0f8e75343f651b1055f81cec5348a0c87f1b71/java/Ti...

 

I am not sure about preprocessor, can you share the APIs/Examples which you are using to create preprocessor?



Arun Patidar

Avatar

Level 1

Hi @arunpatidar,

 

the preprocessor should also work, here is an example: https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adob...

However, I just tried it locally but the preprocess(...) method is never triggered. Has anyone successfully implemented it?

 

BR,

Daniel