Hi,
I've written ResourceChangeListener to listen to "ADDED, REMOVED, CHANGED" event and code deployed on version AEM 6.3, 6.4.
The listener is working fine for any path under /content but not working for /content/usergenerated/asi/jcr.
Anyone have any idea about why it doesn't work for this specific path?
Regards,
Himanshu
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Please find below:
aem63app-repo/SampleJCRUGD.java at master · arunpatidar02/aem63app-repo · GitHub
Hi,
Could you please share more details? or sample code? You may check permission under /content/usergenerated/asi/jcr
Thanks
Arun
Views
Replies
Total Likes
Hi,
Please find below the sample code.
import java.util.List;
import org.apache.sling.api.resource.observation.ResourceChange;
import org.apache.sling.api.resource.observation.ResourceChangeListener;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* User Generated Data replicator
*/
@Component(service = ResourceChangeListener.class, property = { ResourceChangeListener.PATHS + "=" + "/content",
ResourceChangeListener.CHANGES + "=" + "ADDED", ResourceChangeListener.CHANGES + "=" + "REMOVED",
ResourceChangeListener.CHANGES + "=" + "CHANGED" })
public class UGCDataReplicator implements ResourceChangeListener {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Override
public void onChange(List<ResourceChange> resourceChanges) {
log.debug("Changed Resources " + resourceChanges);
}
}
And, about the permission there shouldn't be any concern cos' this code is being executed on Author with logged in as Admin user.
Regards,
Himanshu
Views
Replies
Total Likes
activating the service immediately, try to include this property in @component
immediate = true
Views
Replies
Total Likes
Hi,
Yes, you are right. Your code looks ok and I also tried. But ResourceChangeListener is not working under that path.
However JCR Events working as expected on the same path.
I am not sure what could be the reason.
Thanks
Arun
Views
Replies
Total Likes
Hi,
Could you please provide sample code for JCR event based on OSGI R6 annotation?
Regards,
Himanshu
Views
Replies
Total Likes
Hi,
Please find below:
aem63app-repo/SampleJCRUGD.java at master · arunpatidar02/aem63app-repo · GitHub