Search in sources :

Example 1 with RemoteObservationManager

use of org.xwiki.observation.remote.RemoteObservationManager in project xwiki-platform by xwiki.

the class LocalEventListener method onEvent.

@Override
public void onEvent(Event event, Object source, Object data) {
    if (this.remoteObservationManager == null) {
        try {
            // Make sure to not receive events until RemoteObservationManager is ready
            ObservationManager om = this.componentManager.getInstance(ObservationManager.class);
            om.removeListener(getName());
            this.remoteObservationManager = this.componentManager.getInstance(RemoteObservationManager.class);
            om.addListener(this);
            this.remoteObservationManager.notify(new LocalEventData(event, source, data));
        } catch (ComponentLookupException e) {
            this.logger.error("Failed to initialize the Remote Observation Manager", e);
        }
    } else {
        this.remoteObservationManager.notify(new LocalEventData(event, source, data));
    }
}
Also used : LocalEventData(org.xwiki.observation.remote.LocalEventData) ObservationManager(org.xwiki.observation.ObservationManager) RemoteObservationManager(org.xwiki.observation.remote.RemoteObservationManager) RemoteObservationManager(org.xwiki.observation.remote.RemoteObservationManager) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException)

Aggregations

ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 ObservationManager (org.xwiki.observation.ObservationManager)1 LocalEventData (org.xwiki.observation.remote.LocalEventData)1 RemoteObservationManager (org.xwiki.observation.remote.RemoteObservationManager)1