Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

EventConstants.EVENT_FILTER is not triggered under /conf

Avatar

Level 4

Hi There,

Does anyone know why this is not triggered, i want to get the removed event under this node /conf.

@component(
    service = EventHandler.class,
    immediate = true,
    property = {
        EventConstants.EVENT_TOPIC + "=" + TestEventHandler.EVENT_TOPIC,
        EventConstants.EVENT_FILTER + "=(path=/conf/*)"
    }
)
@Slf4j
public class TestEventHandler implements EventHandler {

    public static final String EVENT_TOPIC = "org/apache/sling/api/resource/Resource/REMOVED";

........

 -  

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
 

Hi @anelem1760873 ,

 

Just check if the system user is having right permission which you must be using to get resolver. Like below-

 

Map<String, Object> params = new HashMap<>();
params.put(ResourceResolverFactory.SUBSERVICE, "myEventService");
resolver = resolverFactory.getServiceResourceResolver(params);

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor
 

Hi @anelem1760873 ,

 

Just check if the system user is having right permission which you must be using to get resolver. Like below-

 

Map<String, Object> params = new HashMap<>();
params.put(ResourceResolverFactory.SUBSERVICE, "myEventService");
resolver = resolverFactory.getServiceResourceResolver(params);

 

Avatar

Community Advisor

Alright! Agree with Ritesh. use a resource resolver using the service user and resource resolver factory.

A good article describes this - http://www.aemcq5tutorials.com/tutorials/create-system-user-in-aem/

 

make sure to give proper permission to the user.

 

Debug it and check if you are getting a resource resolver.