Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Issue with ResourceChangeListener functionality

Avatar

Level 2

I need to save few property(customlastModified and loggedinUser based ) on dropdown selction (inprogress and approved) of basic tab of page. To implment this I used OOTB property i.e. resourceChnageListener and overridden on chnage menthod. One strange behavious I have notices is it is triggering lots of other pages even if that particular property is not chnaged. Due to which my log size is growing exponentially and making my local system filled as segment store size is getting bigger and bigger becuase of it.

On my local instance, the error log file grows up to 4GB if the instance runs overnight.

Sample code snippet

@component(immediate = true,
service = ResourceChangeListener.class,
property = {
ResourceChangeListener.PATHS + "=" + "<pagePath>",
ResourceChangeListener.CHANGES + "=" + "CHANGED",
ResourceChangeListener.PROPERTY_NAMES_HINT + "<propertyName>"
})

public class PropertyChangeListener implements ResourceChangeListener{


@Override
public void onChange(@NotNull List<ResourceChange> list) {
for (ResourceChange resourceChange : list){}}

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Avatar

Level 8

The ResourceChangeListener.PROPERTY_NAMES_HINT can be somewhat misleading, as it implies that the listener is exclusively focused on the specified property names. However, this is merely a suggestion; a change listener that registers with this property should be aware that the underlying implementation may not filter events based on it. As a result, the listener may receive all events defined by the other properties and this aspect must be taken into consideration in your implementation.