// strip "event/connectionState"
String name = event.substring(0, index);
ClusterNode[] nodes = clusterManager.getClusterNodes();
for (int ic=0; ic<nodes.length; ic++) {
ClusterNode node = nodes[ic];
SessionName destination = node.getSessionName();
if (destination != null && destination.matchRelativeName(name)) {
node.registerConnectionListener(this);
}
}
}
else if (isCallbackStateEvent(event)) {
//else if (event.endsWith("/event/callbackState") || event.endsWith("/event/callbackAlive") || event.endsWith("/event/callbackPolling") || event.endsWith("/event/callbackDead")) {
// OK: "client/joe/session/1/event/callbackState"
// Not yet supported: "client/joe/session/1/event/callbackAlive", "client/joe/session/1/event/callbackPolling"
int index = event.lastIndexOf("/event/");
if (index == -1) {
log.warning("Configuration of '" + event + "' is ignored, wrong syntax");
continue;
}
String name = event.substring(0, index);
SessionName sessionName = new SessionName(this.engineGlob, name);
this.requestBroker.getAuthenticate().addClientListener(this);
if (this.callbackSessionStateSet == null) this.callbackSessionStateSet = new TreeSet();
if (event.startsWith(ContextNode.SUBJECT_MARKER_TAG+ContextNode.SEP+"*"+ContextNode.SEP) ||
event.endsWith(ContextNode.SESSION_MARKER_TAG+ContextNode.SEP+"*"+"/event/callbackState")) {
// "client/*/session/1/event/callbackState" or "client/joe/session/*/event/callbackState"
if (this.pendingCallbackSessionInfoSet == null) this.pendingCallbackSessionInfoSet = new TreeSet();
this.pendingCallbackSessionInfoSet.add(name);
this.callbackSessionStateSet.add(name);
SubjectInfo[] subs = null;
log.fine("Register existing wildcard callback session state event = " + event);
if (event.startsWith(ContextNode.SUBJECT_MARKER_TAG+ContextNode.SEP+"*"+ContextNode.SEP) &&
!event.endsWith(ContextNode.SESSION_MARKER_TAG+ContextNode.SEP+"*"+"/event/callbackState")) {
subs = this.requestBroker.getAuthenticate().getSubjectInfoArr();
for (int sj=0; sj<subs.length; sj++) {
SubjectInfo subjectInfo = subs[sj];
if (!wildcardMatch(sessionName.getLoginName(), subjectInfo.getLoginName()))
continue;
SessionInfo[] ses = subjectInfo.getSessions();
for (int se=0; se<ses.length; se++) {
if (!wildcardMatch(sessionName.getPublicSessionId(), ses[se].getPublicSessionId()))
continue;
DispatchManager mgr = ses[se].getDispatchManager();
if (mgr != null) {
mgr.addConnectionStatusListener(this);
}
}
}
}
}
else {
log.fine("Register callback session state event = " + event);
SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
DispatchManager mgr = null;
if (sessionInfo != null)
mgr = sessionInfo.getDispatchManager();
if (mgr != null) {
mgr.addConnectionStatusListener(this);
}
else {
if (this.pendingCallbackSessionInfoSet == null) this.pendingCallbackSessionInfoSet = new TreeSet();
this.pendingCallbackSessionInfoSet.add(sessionName.getAbsoluteName());
}
this.callbackSessionStateSet.add(sessionName.getRelativeName());
}
}
else if (isConnectionQueueEvent(event)) {
// client/[subjectId]/session/[publicSessionId]/queue/connection/event/threshold.90%
// TODO: register in xmlBlasterAccess of each ClusterNode client