Custom Replication Event Handler not triggering intermittently on page activations. Please suggest.
Hello Team,
Custom Replication Handler is not triggering intermittently. It triggers for some time and does not trigger for a while and all those activation events are lost. To explain it better page is getting activated on to the publish instance, but activation event handler is not being kicked in.
We have a functionality of sending activated page information to third party system and there by third party system triggers an email to the subscribers. But due to this intermittent nature, replication event is not triggering at times and losing the activation of the page events, there by subscribers are not getting the email notifications.
Here is my replication listener code.
@Service(value = EventHandler.class)
@Component(immediate = true)
@Property(name = "event.topics", value = ReplicationAction.EVENT_TOPIC)
public class GlobalReplicationListener implements EventHandler{
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalReplicationListener.class);
@Reference
ResourceResolverFactory resourceResolverFactory;
@Reference
private ThirdPartyIntegrationService thirdPartyIntegrationService;
private BundleContext bundleContext;
@Override
public void handleEvent(Event event) {
ReplicationAction action = ReplicationAction.fromEvent(event);
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, SUBSERVICE_USER_NAME_WRITE);
if (action.getType() != null && action.getType().equals(ReplicationActionType.ACTIVATE)) {
LOGGER.info("+++++++++++++ Replication Event Activation is invoked ++++++++++++++++++" +action.getPath());
Resource resource = resolver.getResource(action.getPath());
//get the jcr information from the resource value map and call the thirdparty service.
thirdpartyService.sendPageInformation();
}
}
protected void activate(ComponentContext ctx) {
this.bundleContext = ctx.getBundleContext();
}
protected void deactivate(ComponentContext ctx) {
this.bundleContext = null;
}
}
I have even tried the osgi configuration of felix event admin impl by configuring the time out for the package where my listener is.
/apps/mycompany/config.author/org.apache.felix.eventadmin.impl.EventAdmin.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
org.apache.felix.eventadmin.ThreadPoolSize="{Long}20"
org.apache.felix.eventadmin.AsyncToSyncThreadRatio="{Double}0.5"
org.apache.felix.eventadmin.Timeout="{Long}5000"
org.apache.felix.eventadmin.RequireTopic="{Boolean}true"
org.apache.felix.eventadmin.IgnoreTimeout="[org.apache.felix*,org.apache.sling*,com.day*,com.adobe*,com.mycompany.listeners.*]"
org.apache.felix.eventadmin.IgnoreTopic="[]"/>
I am not seeing any thing specific in the logs why my event handler is not firing intermittently. Could some one help me by providing some pointers/suggestions to solve this problem?