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
BedrockMission!

Learn More

View all

Sign in to view all badges

Event Handler Not Working in AEM 6.4

Avatar

Avatar
Validate 1
Level 1
gauravp49120709
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
gauravp49120709
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
gauravp49120709
Level 1

23-08-2018

******************************************************************************************************************************************************************************

Hi,

We have implemented an Event Handler registered as below:

    import org.apache.felix.scr.annotations.Component;

    import org.apache.felix.scr.annotations.Properties;

    import org.apache.felix.scr.annotations.Property;

    import org.apache.felix.scr.annotations.Reference;

    import org.apache.felix.scr.annotations.Service;

    import org.apache.sling.api.SlingConstants;

    import org.apache.sling.api.resource.ResourceResolverFactory;

    import org.apache.sling.api.resource.observation.ResourceChangeListener;

    import org.osgi.service.event.Event;

    import org.osgi.service.event.EventConstants;

    import org.osgi.service.event.EventHandler;

    import org.slf4j.Logger;

    import org.slf4j.LoggerFactory;

   

   

    /**

     * This is a node observer class which would observe the path /content/we-retail

     * for any addition or updation of nodes (type = cq:PageContent).

     * @author

     */

   

    @Component(label = "Test Event Listener", immediate = true, metatype =

        false, enabled = true)

    @Properties({

       

       /* @Property(name = EventConstants.EVENT_TOPIC, value = ReplicationAction.EVENT_TOPIC)

})*/

@Property(name = EventConstants.EVENT_TOPIC, value =

{"org/apache/sling/api/resource/Resource/ADDED",

"org/apache/sling/api/resource/Resource/CHANGED"}),

        @Property(name = EventConstants.EVENT_FILTER, value = "(&" +

"(path=/content/we-retail/us/en/*/jcr:content) (|(" + SlingConstants

.PROPERTY_CHANGED_ATTRIBUTES + "=*jcr:title) "

            + "(" + ResourceChangeListener.CHANGES + "=*jcr:title)))")

    })

   

    @Service(EventHandler.class)

    public class TestEventHandler implements EventHandler {

   

        private static final Logger LOG = LoggerFactory.getLogger(TestEventHandler.class);

   

        /*

         * Reference of ResourceResolverFactory object.

         */

        @Reference

        private ResourceResolverFactory resourceResolverFactory;

   

        /*

         * (non-Javadoc)

         * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)

         */

        @Override

        public void handleEvent(Event event) {

LOG.info("Hi event is called ......");

        }

   

    } 

   

Issue is: Our handleEvent doesn't get trapped when change the property value for jcr:title on any page under the path: /content/we-retail/us/en

AEM version is: 6.4

sling version used is : org.apache.sling.api

View Entire Topic

Avatar

Avatar
Validate 1
Level 2
Santhi_Swaroop
Level 2

Likes

16 likes

Total Posts

28 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
Santhi_Swaroop
Level 2

Likes

16 likes

Total Posts

28 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Santhi_Swaroop
Level 2

13-11-2018