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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Capturing publish event using ResourceChangeListener

Avatar

Level 3

Hi,

I wanted to capture asset activation event and do some changes. I'm trying using ResourceChangeListener and with property name hints but the event is getting captured for all change events such as image edits. I wanted the event to be captured only on Asset activation. Any help?

 

@Component(service = ResourceChangeListener.class,
property = {
ResourceChangeListener.PATHS + "=/content/dam/",
ResourceChangeListener.CHANGES + "=CHANGED",
ResourceChangeListener.PROPERTY_NAMES_HINT + "=*cq:lastReplicationAction"
},

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @Ashwin_Raju 

In my opinion the best way to implement any action on a Publish Event, is using Sling Events. Resource ChangeListeners are more for Resource Change Events. Eg, creating, modifying and deleting a Resource.

 

Please find below link to find out preferable listeners for different events:

https://techrevel.blog/2017/03/21/resourcechangelistener-vs-sling-event/

 

 

 

2 Replies

Avatar

Correct answer by
Employee

Hi @Ashwin_Raju 

In my opinion the best way to implement any action on a Publish Event, is using Sling Events. Resource ChangeListeners are more for Resource Change Events. Eg, creating, modifying and deleting a Resource.

 

Please find below link to find out preferable listeners for different events:

https://techrevel.blog/2017/03/21/resourcechangelistener-vs-sling-event/

 

 

 

Avatar

Community Advisor

Hi @Ashwin_Raju 

As suggested by @krati_garg better use sling events and below is the article which discuss the same on cloud and 6.5 as well

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-as-cs-handle-event-on-...