Expand my Community achievements bar.

Who Me Too'd this topic

Avatar

Level 7

Hello Everyone,

I am writing an EventListener but the onEvent() method is not getting called if I create the session by doing below:

Map<String, Object> param = new HashMap<>()
param.put(ResourceResolverFactory.SUBSERVICE, "SUBSERVICENAME")
resourceResolver = resourceResolverFactory.getServiceResourceResolver(param)
session = resourceResolver.adaptTo(Session.class)

however if I am creating the session by "repository.loginAdministrative(null)" the class is working as expected and the onEvent() is getting called. The latest example in the ACS Commons github is also getting the session by "repository.loginAdministrative(null)".
https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/ad...

But it is not advisable to use repository.loginAdministrative(null) to obtain the session, not to mention its also deprecated. I was just wondering if anyone have faced this before and have some possible solution.

Thanks and Regards,

Tuhin

P.S: My service user have all the permission it needs to do any kind of operation on node.

Who Me Too'd this topic