Event Handling in AEM 6.4 | Adobe Higher Education
Skip to main content
Level 3
July 19, 2018

Event Handling in AEM 6.4

  • July 19, 2018
  • 3 respuestas
  • 9445 visualizaciones

Hi,

We have various event handlers which are not working in 6.4 since various attributes(resourceChangedAttributes etc.) are removed from Sling Events.  I was wondering if Adobe I/O Event handling can be a potential solution??  Has anyone tried this ?

Thanks,

Rachna

Este tema ha sido cerrado para respuestas.

3 respuestas

arunpatidar
Community Advisor
Community Advisor
July 19, 2018

Hi,

you can use JCR events.

AEM 6.3 Event problem

Arun Patidar
smacdonald2008
Level 10
July 19, 2018

Agree with Arun - JCR Events are lower level API then Sling Events.

Level 3
July 19, 2018

Thanks both!

JCR Events has an issue when it comes to getting admin session, it's not allowing to get session using standard sys users way, and it requires to use deprecated method repository.loginAdministrative(null) & whitelisting the bundle to get the session;

I was thinking to go for higher level Page topics or Adobe I/O events for aem, any idea which is better compare to JCR events as deprecation is strongly discouraged as far as I know!  I wanted to try Adobe I/O and it supports custom osgi events too.

Thanks,

Rachna

arunpatidar
Community Advisor
Community Advisor
July 19, 2018

Hi,

You can try below to get Session using below to observe JCR events.

session = repository.loginService("subservice-name", null);

you need to create subservice to use system user and create mapping through web console

e.g.

session = repository.loginService("readService", null);

this will create session with training-user

aem63app-repo/SampleJCRUGD.java at master · arunpatidar02/aem63app-repo · GitHub

Thanks

Arun

Arun Patidar
Level 3
July 20, 2018

Thanks Arun,

I have tried above option and after deploying it to 6.4,  seems like I am getting null pointer exception when I am trying to get the session using repository.loginService("readService", null); and getting null value for the repository.

I have initialised repository using following line.

@Reference
private SlingRepository repository;

Thanks,

Rachna

Level 3
March 29, 2019

anjalishyamsundar​  Hi yeah you can try JCR Events but I didn't use it because it's not cluster safe and very low level, requires lot of filtering in the code before we reach to interested event.  I am also not using osgi annotations so that's another blocker for me to go for JCR Events.