private void addListeners() throws ConfigurationException { QFactory factory = getFactory(); Iterator iter = getPersist().getChildren("request-listener").iterator(); while (iter.hasNext()) { Element l = (Element) iter.next(); ISORequestListener listener = (ISORequestListener) factory.newInstance(l.getAttributeValue("class")); factory.setLogger(listener, l); factory.setConfiguration(listener, l); server.addISORequestListener(listener); } }
private void initOut() { Element persist = getPersist(); outQueue = persist.getChildText("out"); if (outQueue != null) { /* * We have an 'out' queue to send any messages to that are received * by the our requestListener(this). * * Note, if additional ISORequestListeners are registered with the server after * this point, then they won't see anything as our process(ISOSource, ISOMsg) * always return true. */ server.addISORequestListener(this); } }
public static void main(String[] args) throws Exception { XMLChannel clientSide = new XMLChannel(new XMLPackager()); // without a logger on the channel we don't see send and receive only session-start and -end Logger logger = Common.logger("server"); clientSide.setLogger(logger, "server"); String pid = getPid(); System.out.println("PID " + pid); Files.write(Common.SERVER_PID, pid.getBytes(), CREATE, TRUNCATE_EXISTING); ISOServer server = new ISOServer(10000, clientSide, new ThreadPool(1, 2, "simple-server")); server.setConfiguration(new SimpleConfiguration()); server.addISORequestListener(pongListener()); server.setLogger(logger, "server"); server.run(); }