示例#1
0
文件: QServer.java 项目: Zengwn/jPOS
 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);
   }
 }
示例#2
0
文件: QServer.java 项目: Zengwn/jPOS
 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);
   }
 }
示例#3
0
  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();
  }