use of com.creditease.agent.feature.globalnotify.GlobalNotificationManager in project uavstack by uavorg.
the class GlobalNotificationAgent method exchange.
@Override
public Object exchange(String eventKey, Object... data) {
if (null == data) {
return null;
}
switch(eventKey) {
case "global.notify":
if (!NotificationEvent.class.isAssignableFrom(data[0].getClass())) {
log.warn(this, "Wrong Data Type for Event [global.notify]: " + data[0].getClass().getName());
return null;
}
NotificationEvent event = (NotificationEvent) data[0];
GlobalNotificationManager ntfmanager = (GlobalNotificationManager) this.getConfigManager().getComponent(this.feature, "GlobalNotificationManager");
ntfmanager.putData(event);
return null;
}
throw new RuntimeException("Exchange Event [" + eventKey + "] handle FAIL: data=" + data);
}
use of com.creditease.agent.feature.globalnotify.GlobalNotificationManager in project uavstack by uavorg.
the class GlobalNotificationAgent method start.
@Override
public void start() {
// create GlobalNotificationManager
GlobalNotificationManager amnm = new GlobalNotificationManager("GlobalNotificationManager", this.feature, "notifyhandlers");
// start GlobalNotificationManager
globalNotificationManager_es.execute(amnm);
if (log.isTraceEnable()) {
log.info(this, "GlobalNotificationManager started");
}
long expireTime = DataConvertHelper.toLong(this.getConfigManager().getFeatureConfiguration(this.feature, "expireTime"), 4 * 3600) * 1000;
NotificationEventRecordLiferKeeper lifeKeeper = new NotificationEventRecordLiferKeeper("NotificationEventRecordLiferKeeper", this.feature, expireTime);
this.getTimerWorkManager().scheduleWork("NotificationEventRecordLiferKeeper", lifeKeeper, 0, expireTime / 2);
if (log.isTraceEnable()) {
log.info(this, "NotificationEventRecordLiferKeeper started");
}
}
Aggregations