<Critical> Event handler not triggering while delete page
Hi Team,
Event handler not triggering for event topic(SlingConstants.TOPIC_RESOURCE_REMOVED). It is working perfectly fine in all our lower environments even in PROD, but recently in our PROD it is not calling custom event handler which was working in PROD.
I have gone through couple of tickets and blogs(everyone saying event handler is blacklisted after certain time mentioned in "Apache felix Event admin implementation" configuration) , but not find solution except adding ignore list.
Note:
- AEM version - 6.5.11
- All bundles are active and component also active. Able to see component registered in logs.
- As we are getting in critical production application, not suggested restart AEM or start component to solve the issue.
Few queries below.
1) How to find blacklisted event handler? Is there any configurations or any place it will maintain the list of blacklisted eventhandlers?
2) How to find event handler blacklisted in logs?
3) Is there anyway to solve without restarting component or AEM instance?
sample code snippet
@SuppressWarnings("deprecation")
@8220494(immediate = true, metatype = true, label = "Page Delete event")
@1790552(EventHandler.class)
@Properties({ @2542150(name = EventConstants.EVENT_TOPIC, value = { SlingConstants.TOPIC_RESOURCE_REMOVED }),
@2542150(name = Constants.SERVICE_PID, value = "com.company.module.site.listeners.PageDeleteEventHandler", propertyPrivate = true),
@2542150(name = EventConstants.EVENT_FILTER, value = "(path=/content/module/*)"),
@2542150(name = Constants.SERVICE_DESCRIPTION, value = "Page Delete event", propertyPrivate = true),
@2542150(name = Constants.SERVICE_VENDOR, value = "Company") })
public class PageDeleteEventHandler implements EventHandler {
private String className = this.getClass().getName();
@3214626
private SlingSettingsService slingSettingsService;
@3214626
private Replicator replicator;
@3214626
private SlingRepository slingRepository;
@3214626
private IReplicationAgentsConfig agentConfig;
@580286
protected void activate(ComponentContext context) {
String methodName = "activate";
}
@9944223
public void handleEvent(Event event) {
String methodName = "handleEvent";
Session session = null;
try {
if (event != null) {
String path = (String) event.getProperty("path");
session = slingRepository.loginService(null, null);
ReplicationOptions options = fetchReplicationOptions();
ReplicationActionType actionType = DELETE;
replicator.replicate(session, actionType, path, options);
}
}
} catch (RepositoryException e) {
} catch (ReplicationException e) {
} finally {
if (session != null && session.isLive()) {
session.logout();
}
}
}
private ReplicationOptions fetchReplicationOptions() {
String methodName = "fetchReplicationOptions";
ReplicationOptions options = new ReplicationOptions();
AgentFilter agentFilter = new AgentIdFilter(<<getting replication agent>>);
options.setSuppressVersions(true);
options.setFilter(agentFilter);
return options;
}
}
