Hi All,
We have a requirement to capture the events (like create/modify/delete of pages and nodes) happening on CQ author instance along with their paths,metadata and page properties associated with the resources. This information we are storing into a DB for indexing and reporting purposes.
Please suggest the best way to implement this solution.
Regards
Nivas
Solved! Go to Solution.
Views
Replies
Total Likes
Implement an EventListener OSGi service that would listen for these events to occur and then interface with your JDBC service to record to the Database.
I feel compelled to point out that the JCR is a data store and already records all this information in the form of audit nodes and has a built in reporting interface.
Views
Replies
Total Likes
Implement an EventListener OSGi service that would listen for these events to occur and then interface with your JDBC service to record to the Database.
I feel compelled to point out that the JCR is a data store and already records all this information in the form of audit nodes and has a built in reporting interface.
Views
Replies
Total Likes
Here is community article on event handlers in AEM
Views
Replies
Total Likes
Hi Nivas,
There are a variety of OSGi EventAdmin events produced by these activities. You would want to implement an event handler and queue up the events for storage into your database.
Regards,
Justin
Views
Replies
Total Likes
Hi, As suggested, we have implemented the below EventHandler, to capture page events like create, modify, delete, activate and de activate using Page events and Replication events), which we are interested. Please confirm whether this approach is correct.
We have to handle the below 3 more scenarios, please suggest.
1. First time, as one time activity, we have to store the current status of all the pages ( page url, locale, node_update_date) in CQ into DB.
2. On adhoc basic, we have to store the current status of all the pages for certain time period (say from date to to date).
3. The event handler should be running always and should handle bulk activation's (say 1000 at a time), please suggest the proper design to the event handler.
package com.intel.myintel.servlets;
import com.day.cq.replication.ReplicationAction;
import com.day.cq.wcm.api.PageEvent;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
@Component
@Service
@Property(name="event.topics",value= {ReplicationAction.EVENT_TOPIC, PageEvent.EVENT_TOPIC})
public class CustomAgent implements EventHandler {
private final Logger LOG = LoggerFactory.getLogger(CustomAgent.class);
@Override
public void handleEvent(org.osgi.service.event.Event event) {
if (event.getTopic().equals(ReplicationAction.EVENT_TOPIC)){
LOG.info("Event captured!!");
// get page url,locale,node_update_date and save to DB
}else if(event.getTopic().equals(PageEvent.EVENT_TOPIC)){
LOG.info("Event captured!!");
// get page url,locale,node_update_date and save to DB
}
}
}
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies