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?
In general, an event handler has the name of the event, preceded by "on." For example, the event handler for the Focus event is onFocus. Many objects also have methods that emulate events. For example, button has a click method that emulates the button being clicked.
Note: Event handlers are sometimes called event listeners — they are pretty much interchangeable for our purposes, although strictly speaking, they work together. The listener listens out for the event happening, and the handler is the code that is run in response to it happening.
In programming, an event handler is a callback routine that operates asynchronously once an event takes place. It dictates the action that follows the event. The programmer writes a code for this action to take place. An event is an action that takes place when a user interacts with a program.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With