integrating the jpos with the rest web-services

853 views
Skip to first unread message

kahkean kean

unread,
Sep 5, 2015, 4:59:16 PM9/5/15
to jPOS Users
hi guys, currently i am integrating the jpos with the rest web-services. whenever a web services call from user, the qmux in the web-services method will communicate with the q2server locally . But i curios should i create the threading to handle multi access ?  or i just left it, since i saw Most webservers (Java and otherwise, including JBoss) follow a "one thread per request" model
 thanks


GenericPackager packager = new GenericPackager(Q2Client.selectedFile.getAbsolutePath());                  <-global variable
    @GET
    @Path("/get/{isomsg}")
    @Produces(MediaType.TEXT_PLAIN)   
    public String add(@PathParam("isomsg") String isomsg) throws ISOException, NotFoundException {

                 ISOMsg isoMsg2 = new ISOMsg();
        isoMsg2.setPackager(packager);
                isoMsg2.unpack(isomsg.getBytes());

                 MUX mux = QMUX.getMUX("qmuxclient");
                ISOMsg respMsg = mux.request(isoMsg2, 30000L);
 
        return new String(respMsg.pack());
    }

chhil

unread,
Sep 6, 2015, 11:44:13 PM9/6/15
to jpos-...@googlegroups.com

You should use the transaction manager to enable multi threading.
The idea is to pass on the request to a txn Mgr which has a number of sessions (threads) to allow the processing of requests in parallel.
See sample at http://jpos.org/blog/2013/10/eating-our-own-dogfood/

However in you current scenario you just seem to be forwarding the request to an entity via your mux.

-chhil

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/bf8098f5-7dd3-44bd-a119-6e2cf374297b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

EdPimentl

unread,
Sep 7, 2015, 8:31:35 AM9/7/15
to jpos-...@googlegroups.com
Hopefully soon we will see JPOS REST-JSON API, JPOS with Blockchain PLUGin, JPOS CONTAINERS/MicroServices


Best,
-E
IoT Cloud Labs (In Stealth Mode)

Mark Salter

unread,
Sep 9, 2015, 6:00:10 PM9/9/15
to jpos-...@googlegroups.com
On 05/09/15 21:59, kahkean kean wrote:
> But i curios should i create the threading to handle multi access ?
The webserver your code is running under will already have provided a
thread to run in and will have a 'pool ' of threads waiting to serve
each connect/request it receives.

> or i just left it,
I would leave it as is too - the threads to handle connections, space
queues and in the transaction manager will be ready to handle the onward
trip of the request.

--
Mark
Reply all
Reply to author
Forward
0 new messages