Replication listener in publish aem
I am trying to write a listener which listens to page activation but in Publish Environment. The code which I have written works in author environment but doesn't in publish, i.e. it doesn't listen to Replication even in pub environment. I have attached the underlying code. Any help is highly appreciated.
@Component @Service @Properties({ @Property( label = "Event Topics", value = { ReplicationAction.EVENT_TOPIC }, description = "[Required] Event Topics this event handler will to respond to.", name = EventConstants.EVENT_TOPIC, propertyPrivate = true ), @Property( label = "Event Filters", value = "(" + ReplicationAction.PROPERTY_TYPE + "=ACTIVATE)", name = EventConstants.EVENT_FILTER, propertyPrivate = true ) }) public class SimpleDSComponent implements Runnable, EventHandler { private Logger log = LoggerFactory.getLogger(this.getClass()); private BundleContext bundleContext; public void handleEvent(Event event) { String n[] = event.getPropertyNames(); log.info(""); log.info("Event occurred: {}", event.getProperty(WorkflowEvent.EVENT_TYPE)); log.info("Event properties: "); for(String s : n) { log.info(s + " = " + event.getProperty(s)); } ReplicationAction action = ReplicationAction.fromEvent(event); if(action != null) { log.info("Replication action {} occured on {} ", action.getType().getName(), action.getPath()); log.info("Tushar Replication"); } log.info(""); } public void run() { log.info("Running..."); } protected void activate(ComponentContext ctx) { this.bundleContext = ctx.getBundleContext(); } protected void deactivate(ComponentContext ctx) { this.bundleContext = null; } }