Event filter in Event Handler | Community
Skip to main content
November 15, 2022
Solved

Event filter in Event Handler

  • November 15, 2022
  • 2 replies
  • 1791 views

I'm creating an event handler which will run a workflow when an asset is created/uploaded in AEM. I implemented the below filter but multiple events are getting triggered for multiple resource types (original asset and renditions). Is there a way to add a resource type filter so that it is only triggered when resource type is "dam:Asset"?

 

 

@Component(service = EventHandler.class, immediate = true, property = {
Constants.SERVICE_DESCRIPTION + "=DAM Asset Events ",
EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/ADDED",
EventConstants.EVENT_FILTER + "= (path=/content/dam/*)" })

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Vajrala

@reddyishanvi Based on the use case, I think the best approach would be using the Workflow Launchers, which triggers the workflow when an asset is uploaded, where you can configure the NodeType, path globbing, and exclude properties and conditions. Also, you have the option to deactivate through UI. 

Please check the OOTB workflow launchers here - http://localhost:4502/mnt/overlay/cq/workflow/admin/console/content/launchers.html 

2 replies

Lokesh_Vajrala
Community Advisor
Lokesh_VajralaCommunity AdvisorAccepted solution
Community Advisor
November 15, 2022

@reddyishanvi Based on the use case, I think the best approach would be using the Workflow Launchers, which triggers the workflow when an asset is uploaded, where you can configure the NodeType, path globbing, and exclude properties and conditions. Also, you have the option to deactivate through UI. 

Please check the OOTB workflow launchers here - http://localhost:4502/mnt/overlay/cq/workflow/admin/console/content/launchers.html 

Adobe Employee
November 15, 2022

As per your requirements, recommended way is to use workflow Launchers rather Event Handler.

  • Select the resource type as dam:Asset
  • Add condition based on Node modify
  • Enable the workflow which you want to invoke.