Using the UM Java API, I am attempting to return durable subscriber information which includes “Last Read Time”. It appears I need to obtain the “connections” for a nDurableNode instance in order to obtain the “Last Read Time” information (that information on the nDurableNode instance appears to always 0). However, when I execute the .getConnections() method, I do not get any connections.
Below is my code written as an IS Java Service (currently just returning a list of information for debugging). Any ideas on what I may be doing incorrectly would be most appreciated. Thank you!
public static final void getTriggerInfo(IData pipeline) throws ServiceException {
String[] RNAME = {"nsp://xmedid1:9087"};
nSessionAttributes nsa = null;
nSession lSession = null;
nRealmNode rNode = null;
String[] channelNames = null;
ArrayList<String> infoArray = new ArrayList<String>(100);
try {
nsa = new nSessionAttributes(RNAME);
rNode = new nRealmNode(nsa);
lSession = nSessionFactory.create(nsa);
lSession.init();
nChannelAttributes[] channelList = lSession.getChannels();
for (int j = 0; j < channelList.length; j++) {
nTopicNode topic = (nTopicNode)rNode.findNode(channelList[j].getFullName());
List<nDurableNode> durableList = topic.getDurableList();
Iterator<nDurableNode> itd = durableList.iterator();
while (itd.hasNext()) {
nDurableNode durable = (nDurableNode)itd.next();
infoArray.add("Durable: " + durable.getName());
Iterator<nDurableConnectionNode> itc = durable.getConnections();
while (itc.hasNext()) {
nDurableConnectionNode durableConnection = (nDurableConnectionNode)itc.next();
infoArray.add("Durable connection: " + durable.getName() + ", " + durableConnection.getId() + ", " + durable.getDepth() + ", " + new Date(durableConnection.getLastReadTime()));
}
}
}
if (infoArray.size() > 0) {
channelNames = new String[infoArray.size()];
infoArray.toArray(channelNames);
}
IDataCursor idcin = pipeline.getCursor();
IDataUtil.put(idcin, "channelNames", channelNames);
idcin.destroy();
lSession.close();
} catch (Exception e) {
IDataCursor idcin = pipeline.getCursor();
IDataUtil.put(idcin, "exception", e.toString());
idcin.destroy();
}