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.
Views
Replies
Total Likes
Thanks for answer. I checked this page and I could not found any workflow for this event. Why schould I check it?
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 ?
How will it help me to find a solution?
@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.
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.
@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.htmlThanks,
Ratna Kumar.
For me the links redirects to https://community.adobe.com/
@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
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):
@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
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.