Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM 6.5: How do I remove an event from page?

Avatar

Level 7

Hello,

through search in Internet I found this site: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/delete-event-listener/m-p/...

Unfortunaltly the provided links produces a 404 error. So my question is, how can I remove an event from a page with AEM6.5?

 

Thanks in advanced.

10 Replies

Avatar

Level 2

@Magicr Please check if there is any launcher configured for your page/hierarchy
<server>/libs/cq/workflow/admin/console/content/launchers.html

Avatar

Level 7

Thanks for answer. I checked this page and I could not found any workflow for this event. Why schould I check it?

Avatar

Level 2

What kind of event is getting invoked? When it's invoked? Do you see any code in your repository causing this? Also, have you checked logs ?

Avatar

Level 7

 


@mobans  schrieb:

What kind of event is getting invoked? When it's invoked? Do you see any code in your repository causing this? Also, have you checked logs ?


I added programmatically to a page the events "Add property", "Remove property", "Changed property". Preventing multiple assignments of same events I want to remove some.

Avatar

Community Advisor

Hi,

The link works, here is the response from page

 

 

Hi Vishwanath,

Basically when you delete the pages/nodes or assets, the event listener must trigger the events.

Look into this article which discuss of your use case: 

https://helpx.adobe.com/experience-manager/using/events.html
https://helpx.adobe.com/experience-manager/kb/ReplicationListener.html

Thanks,
Ratna Kumar.



Arun Patidar

Avatar

Level 7

@arunpatidar  schrieb:

Hi,

The link works, here is the response from page

 

 

Hi Vishwanath,

Basically when you delete the pages/nodes or assets, the event listener must trigger the events.

Look into this article which discuss of your use case: 

https://helpx.adobe.com/experience-manager/using/events.html
https://helpx.adobe.com/experience-manager/kb/ReplicationListener.html

Thanks,
Ratna Kumar.


For me the links redirects to https://community.adobe.com/

Avatar

Community Advisor

@Magicr Removing the event from the class "com.day.cq.wcm.api.PageEvent" will not be easy as could be that there are many things interlinked to this event.

Currently in AEM the Page event is registered with the topic "com/day/cq/wcm/core/page" and all the events i.e.

PROPERTY_MODIFICATIONS
PROPERTY_APPLICATION
PROPERTY_DISTRIBUTE

all are getting triggered from the single topic.

And the event PROPERTY_MODIFICATIONS consists of the below list 

    CREATED("PageCreated"),
    MODIFIED("PageModified"),
    MOVED("PageMoved"),
    DELETED("PageDeleted"),
    VERSION_CREATED("VersionCreated"),
    RESTORED("PageRestored"),
    ROLLEDOUT("PageRolledOut"),
    VALID("PageValid"),
    INVALID("PageInvalid");

And this is a list rather than some OSGi configuration which could be changed easily. So ideally removing the event a Page is not a feasible solution.

 

Thanks 

 

 

Avatar

Community Advisor

Hi @Magicr,

If you are trying to trigger listeners on DELETE/REMOVED of Asset or Pages with EventHandler(org.osgi.service.event.EventHandler) that may not work properly because some of the EVENT_TOPIC( like TOPIC_RESOURCE_REMOVED, ) are deprecated and suggested to use ResourceChangeListener- https://sling.apache.org/apidocs/sling9/org/apache/sling/api/resource/observation/ResourceChangeList... 

Check out the deprecation here-  https://sling.apache.org/apidocs/sling9/org/apache/sling/api/SlingConstants.html#TOPIC_RESOURCE_REMO... 

You can use ResourceChangeListener to trigger a listener on Page or Asset Deletion as below. It will work for all cases(Tested it, working fine for me):

  • Deleting Assets from the DAM
  • Deleting Pages from Sites
  • Deleting Assets or Pages from CRX/DE ( It will trigger when you will click on Save All)
@Component(service = ResourceChangeListener.class, property = {
ResourceChangeListener.PATHS + "=" + "/content",
ResourceChangeListener.CHANGES + "=" + "REMOVED"
}
)
public class RemovedResourceChangeListener implements ResourceChangeListener {
public static final Logger LOGGER = LoggerFactory.getLogger(RemovedResourceChangeListener.class);

@Override
public void onChange(List<ResourceChange> list) {
list.forEach((change) -> {
LOGGER.info(change.getPath());
LOGGER.info(change.getType().toString());
//Custom Code Implementation
});
}
}

Hope this could help you!!!

Regards,

Shiv

 

 

Shiv Prakash

Avatar

Level 7

Thanks for your answer. It helped me a lot. Due to the fact that my question has been moved from questions to discussion I'm unable to mark this as accepted answer.