- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
@Nishma If still you are facing issue, try below one. But i recommand the previous post which worked for me and below code was working in local but not in the AEMcs environment.
Note: I removed some code. Please improvise and try according to your requirement
@Component(
service = EventHandler.class, configurationPolicy = ConfigurationPolicy.REQUIRE,
property = {EventConstants.EVENT_TOPIC+"=" + ReplicationAction.EVENT_TOPIC})
public class ReplicationListenerOnAuthor implements Runnable, EventHandler {
private BundleContext bundleContext;
@Override
public void handleEvent(Event event) {
if (isAuthor()) {
final ReplicationActionType replicationType = ReplicationAction.fromEvent(event).getType();
if (replicationType == ReplicationActionType.ACTIVATE || replicationType == ReplicationActionType.DEACTIVATE || replicationType == ReplicationActionType.DELETE)
{ // service call here
}
}
}
@Override
public void run() {
log.debug("{} Running...", this.getClass().getName());
}
@Activate
protected void activate(ComponentContext componentContext) {
bundleContext = componentContext.getBundleContext();
}
@Deactivate
protected void deactivate() {
bundleContext = null;
}
}
Views
Replies
0 Likes
Total Likes