Skip to main content
Level 3
Nov 17, 2022 5:45 PM UTC
Solved

Capturing publish event using ResourceChangeListener

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
krati_garg
krati_gargAccepted solution
Adobe Employee
Nov 18, 2022 6:35 AM UTC

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

krati_garg
Adobe Employee
krati_gargAdobe EmployeeAccepted solution
Adobe Employee
Nov 18, 2022 6:35 AM UTC

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/

 

 

 

Translate
Mani_kumar_
Community Advisor
Community Advisor
Nov 19, 2022 4:49 PM UTC

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-page-publish/m-p/542044

Translate