user1503952
user1503952

Reputation: 31

How An ISO server can support concurrent requests?

I had implemented ISO SERVER by using ASCII channel and ASCII packager and listening on a port and giving response to ISO requests.

how can i make my server that accepts concurrent requests and send the response.

Please

Upvotes: 2

Views: 3284

Answers (2)

nacadev
nacadev

Reputation: 81

if you are using Q2, just deploy QServer and set the minSessions and maxSessions which its default value is 0 and 100.
here example jPOS server that handle concurent request: http://didikhari.web.id/java/jpos-client-receive-response-specific-port/

Upvotes: 1

Federico González
Federico González

Reputation: 450

ISOServer works with a threadpool, so you can accept concurrent requests out of the box. Every socket connection is handled by its own thread. So, I think all you have to do is assign a ISORequestListener to your ISOServer to actually process your incoming messages.

Here's a test program taken from the jPOS guide:

  public class Test implements ISORequestListener {
    public Test () {
      super();
    }

    public boolean process (ISOSource source, ISOMsg m) {
       try {
           m.setResponseMTI ();
           m.set (39, "00");
           source.send (m);
       } catch (ISOException e) {
           e.printStackTrace();
       } catch (IOException e) {
           e.printStackTrace();
       }
       return true;
    }

    public static void main (String[] args) throws Exception {
        Logger logger = new Logger ();
        logger.addListener (new SimpleLogListener (System.out));
        ServerChannel channel = new XMLChannel (new XMLPackager());
        ((LogSource)channel).setLogger (logger, "channel");
        ISOServer server = new ISOServer (8000, channel, null);
        server.setLogger (logger, "server");
        server.addISORequestListener (new Test ());

        new Thread (server).start ();

    }
}

Upvotes: 0

Related Questions