Highlighted

Day 15 - Eventing In AEM | AEM Community Blog Seeding

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

962

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

962

Correct Answer

1.1K
kautuk_sahni
Community Manager

26-08-2020

BlogImage.jpg

Day 15 - Eventing In AEM by Red Quark

Abstract

Howdy fellow devs 👋! Capturing events in a very common use case in any software system and AEM is no exception. There are many use cases where we need to perform some operation when something specific happens in AEM.

There are various ways by which event handling can be done in AEM -
1. Event Listener - JCR level events with the observation (discussed in this post)
2. Event Handler - Sling level events (discussed in this post)
3. Workflow and Launchers (discussed in previous three posts)
4. Schedulers with cron expressions (will be discussed in the next post)

Event Handlers
We can create an Event Handler by following below steps -
1. Write a service class that implements the EventHandler interface.
2. Register the service with property EventConstants.EVENT_TOPIC.
3. Implement the handleEvent(Event event) method to trigger the job.

Example
Let us create a custom event handler that will be triggered when a page is activated and executes a workflow on the path for which the replication is triggered. The main thing to see here is how we capture the event. Execution of the workflow has the same logic we discussed in the last post discussing trigger workflow programmatically.

Read Full Blog

Day 15 - Eventing In AEM

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager