Expand my Community achievements bar.

SOLVED

AEM 6.5 multiple Sling event handlers ; same topic

Avatar

Level 10

In AEM , say we have two projects within Aem instance where there are two sling event handlers with the same replication action chosen as topic , 

how would one ensure that both run and don't overlap/override and can coexist for the two projects ? 

I could think of filtering by path for the two projects but is it wise ? 

any concerns we could encounter ? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @NitroHazeDev 

 

Yes, you can apply the filter with path specific to the project and that should take care of everything. Based on the events from specific path, the implementation will be picked and there will not be any impact.

 

https://aem.redquark.org/2018/10/day-14-eventing-in-aem.html

 

Thanks!

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @NitroHazeDev 

 

Yes, you can apply the filter with path specific to the project and that should take care of everything. Based on the events from specific path, the implementation will be picked and there will not be any impact.

 

https://aem.redquark.org/2018/10/day-14-eventing-in-aem.html

 

Thanks!

Avatar

Community Advisor

Hi @NitroHazeDev ,

 

You would not want to fire unnecessary event invocations so you should filter for project specific paths. Use path filter, and that should be ideal and good approach and it will also make sure that there will be no overlap/override.

 

https://github.com/riteshmittal/aemscheduler-even-handling/blob/main/EventHandlerExample.java

Avatar

Level 10

Thank you Ritesh and Ashutosh for confirming the path based filtering option

 

That was my understanding as well but happened to hear it wasn't per the best practice and that left me confused.

Thank you ..