当某些 cq5 页面被激活时,我使用以下代码记录一些信息。
@Component
@Service
@Property(name="event.topics",value= {ReplicationAction.EVENT_TOPIC})
public class ExampleEventHandler implements EventHandler {
Logger log = LoggerFactory.getLogger(this.getClass());
public void handleEvent(Event event) {
ReplicationAction action = ReplicationAction.fromEvent(event);
if(action.getType().equals(ReplicationActionType.ACTIVATE)){
log.info("test Event handler")
}
}
}
现在,当我激活页面时,此处理程序会做出反应并记录字符串“测试事件处理程序”。现在,当我第二次或第三次激活页面时,事件处理程序没有反应。我必须从 Felix 控制台重新启动 Service ExampleEventHandler,以便它再次做出反应(一次)。
如何配置事件处理程序(或ReplicationAction),以便ExampleEventHandler每次都做出反应,当页面被激活而无需每次都重新启动Service ExampleEventHandler?