Mateusz Chromiński
Mateusz Chromiński

Reputation: 2832

Finding EventHandler for specific event.topic

I'm discovering AEM workflows and the flow of the Request for Approval model. I've noticed (confirmed on AEM docs) that "if the user does not have the required privileges for publishing a specific page a workflow will be triggered to notify the appropriate person of your request to publish".

Trying to find how it's triggered I've found out ReplicationProcess that handles the activation action and sends a com/day/cq/wcm/workflow/req/for/activation event. Here is where I get lost - none of the AEM OSGi console known to me covers this relationship.

How can I find the event handler that is used for handling a specific event topic?

Upvotes: 5

Views: 1622

Answers (1)

pacoolsky
pacoolsky

Reputation: 134

If you know the event topic you can use bundleContext to find reference to proper EventHandler OSGi service, e.g. using AEM Groovy Console :

ServiceReference[] sr = bundleContext.getServiceReferences(org.osgi.service.event.EventHandler.class, "(event.topics=com/day/cq/wcm/workflow/req/for/activation)")

for (i=0; i< sr.length; i++) {
    println bundleContext.getService(sr[i])
}

Output

com.day.cq.wcm.workflow.impl.WcmWorkflowServiceImpl@618c5804

You can also use OSGi Felix Web Console (services tab) to find it:

web console service tab

Upvotes: 7

Related Questions