查找特定 event.topic 的事件处理程序

Finding EventHandler for specific event.topic

我正在探索 AEM 工作流程和审批请求模型的流程。我注意到(在 AEM docs 上确认)"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".

试图找出它是如何触发的,我发现 ReplicationProcess 处理激活操作并发送 com/day/cq/wcm/workflow/req/for/activation 事件。这是我迷路的地方 - 我所知道的 AEM OSGi 控制台的 none 涵盖了这种关系。

如何找到用于处理特定事件主题的事件处理程序?

如果您知道事件主题,则可以使用 bundleContext 查找对正确的 EventHandler OSGi 服务的引用,例如使用 AEM Groovy 控制台:

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

您也可以使用 OSGi Felix Web 控制台(服务选项卡)找到它: