AEM 6.5 multiple Sling event handlers ; same topic | Community
Skip to main content
Level 9
August 30, 2021
Solved

AEM 6.5 multiple Sling event handlers ; same topic

  • August 30, 2021
  • 2 replies
  • 2025 views

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 ? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

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!

2 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
August 30, 2021

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!

Ritesh_Mittal
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 30, 2021

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

Level 9
August 30, 2021

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 ..