ASK JPos Client receiving 0800 message using isoMUX.setISORequestListener method from remote server

850 views
Skip to first unread message

Didik Hari

unread,
Dec 9, 2014, 12:37:59 AM12/9/14
to jpos-...@googlegroups.com

Hi,
i have some question about JPos client-server.

best practice for sending message to server is using different port every request or use the same port for all request?

from jpos pro guide:
"If you remember QSP and ISOMUX, you might wonder how to handle incoming messages that don't match an
outgoing request (i.e. late responses, network management messages originated by a remote server, etc.).
The old ISOMUX had a request listener for that....."

it's mean that server can send 0800 message to client.
i have create server-client simulator, when server send 0800 at first, there is no problem, but with the second 0800 message, the server got timeout, just like the picture below:

asdadsd



kzjx


this is log of my code:

JposClient log:

<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.7">
 
<connect>
    localhost:12200
 
</connect>
</log>
<log realm="client-isoMux-Logger" at="Tue Dec 09 11:10:37 ICT 2014.19">
 
<mux>
   
<mux-stats connected="true">
           Connections: 1
           TX messages: 0
            TX expired: 0
            TX pending: 1
           RX messages: 0
            RX expired: 0
            RX pending: 1
          RX unmatched: 0
          RX forwarded: 0
   
</mux-stats>
 
</mux>
</log>
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.21">
 
<send>
   
<isomsg direction="outgoing">
     
<field id="0" value="0800"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="000001"/>
     
<field id="70" value="001"/>
   
</isomsg>
 
</send>
</log>
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.25">
 
<receive>
   
<isomsg direction="incoming">
     
<header>FFF006000050</header>
     
<field id="0" value="0810"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="000001"/>
     
<field id="39" value="00"/>
     
<field id="70" value="001"/>
   
</isomsg>
 
</receive>
</log>
Req [0800822000000000000004000000000000001209111037000001001]
Res [081082200000020000000400000000000000120911103700000100001]
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.42">
 
<receive>
   
<isomsg direction="incoming">
     
<header>FFF006000050</header>
     
<field id="0" value="0800"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123450"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</receive>
</log>
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.43">
 
<send>
   
<isomsg direction="outgoing">
     
<header>FFF006000050</header>
     
<field id="0" value="0810"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123450"/>
     
<field id="39" value="00"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</send>
</log>
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.48">
 
<receive>
   
<isomsg direction="incoming">
     
<header>FFF006000050</header>
     
<field id="0" value="0800"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123451"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</receive>
</log>
<log realm="client-channel-logger/127.0.0.1:12200" at="Tue Dec 09 11:10:37 ICT 2014.49">
 
<send>
   
<isomsg direction="outgoing">
     
<header>FFF006000050</header>
     
<field id="0" value="0810"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123451"/>
     
<field id="39" value="00"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</send>
</log>




and this is log of my JPosServer:

<log realm="server-request-channel" at="Tue Dec 09 11:10:37 ICT 2014.42">
 
<send>
   
<isomsg direction="outgoing">
     
<field id="0" value="0800"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123450"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</send>
</log>
<log realm="server-request-channel" at="Tue Dec 09 11:10:37 ICT 2014.45">
 
<receive>
   
<isomsg direction="incoming">
     
<header>FFF006000050</header>
     
<field id="0" value="0810"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123450"/>
     
<field id="39" value="00"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</receive>
</log>
<log realm="server-request-logger" at="Tue Dec 09 11:10:37 ICT 2014.46">
 
<ISORequest>
   
<request>
     
<isomsg direction="outgoing">
       
<field id="0" value="0800"/>
       
<field id="7" value="1209111037"/>
       
<field id="11" value="123450"/>
       
<field id="70" value="301"/>
     
</isomsg>
   
</request>
   
<response elapsed="5">
     
<isomsg direction="incoming">
       
<header>FFF006000050</header>
       
<field id="0" value="0810"/>
       
<field id="7" value="1209111037"/>
       
<field id="11" value="123450"/>
       
<field id="39" value="00"/>
       
<field id="70" value="301"/>
     
</isomsg>
   
</response>
 
</ISORequest>
</log>
Req [0800822000000000000004000000000000001209111037123450301]
Res [081082200000020000000400000000000000120911103712345000301]
<log realm="server-request-channel" at="Tue Dec 09 11:10:37 ICT 2014.48">
 
<send>
   
<isomsg direction="outgoing">
     
<field id="0" value="0800"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123451"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</send>
</log>
<log realm="server-request-channel" at="Tue Dec 09 11:10:37 ICT 2014.49">
 
<receive>
   
<isomsg direction="incoming">
     
<header>FFF006000050</header>
     
<field id="0" value="0810"/>
     
<field id="7" value="1209111037"/>
     
<field id="11" value="123451"/>
     
<field id="39" value="00"/>
     
<field id="70" value="301"/>
   
</isomsg>
 
</receive>
</log>
<log realm="server-request-logger" at="Tue Dec 09 11:11:27 ICT 2014.48">
 
<ISORequest>
   
<request expired="true">
     
<isomsg direction="outgoing">
       
<field id="0" value="0800"/>
       
<field id="7" value="1209111037"/>
       
<field id="11" value="123451"/>
       
<field id="70" value="301"/>
     
</isomsg>
   
</request>
 
</ISORequest>
</log>
Timeout

is there any logic error for my code?

PFA my simulator code.

sorry for my bad english.

Thank you very much.


ClientRequestListener.java
JPosClient.java
JPosServer.java

Mark Salter

unread,
Dec 10, 2014, 1:12:26 PM12/10/14
to jpos-...@googlegroups.com
On 09/12/2014 05:37, Didik Hari wrote:
> best practice for sending message to server is using different port
> every request or use the same port for all request?
This depends on what the server owner decides, but for my money, one
interface, one client - the physical entity, one port; as a server
owner I can do what I like behind that port.

Do you own the server owner Didik?

I appreciate this is test code as you find your feet, but please use
more of the example code from the Programmers guide and try not to add
'stuff' to get things working (other 'stuff' is probably not needed and
may well break other stuff if you make them interact without need)

>
> from jpos pro guide:
> "If you remember QSP and ISOMUX, you might wonder how to handle incoming
> messages that don't match an
> outgoing request (i.e. late responses, network management messages
> originated by a remote server, etc.).
> The old ISOMUX had a request listener for that....."
>
> it's mean that server can send 0800 message to client.
This means that messages that you are not (or no longer) waiting for or
not expecting can arrive. If they do, then the MUX will place them on
the unhandled space queue.

These might be :-

- late responses that you are no longer waiting for, since you have
timed out.
- network management messages that the server initiates
- responses that are not matched to your requests due to incorrect MUX
key setup
- junk.

> i have create server-client simulator, when server send 0800 at first,
> there is no problem,
No problem in that you spot it and reply?

> but with the second 0800 message, the server got
> timeout, just like the picture below:
But for the second 'unhandled' message that arrives you don;t respond
(how about the 3rd or 4th?)?

I wonder if your listener is not completing?

>
> asdadsd
dsdadsa

> <https://lh4.googleusercontent.com/-e89DTsVBBxM/VIaH-Tn8qGI/AAAAAAAADUE/7nYLKm0-wwI/s1600/simulator.png>
noted

> kzjx
xjzk

>
>
xyzzy - just in case these 'codes' are magic words and not something you
expect a reply to :-)

a dwarf appears and throws an axe at you...

... it misses!

(The above is for you old geeks out there!)

> this is log of my code:
This log seems to show the 3rd 0800 not being replied to, or at least
not arriving, but not to worry...


... your code is doing lots of stuff badly - you should try to use the
examples/tests as a base.

As a guide, as I don't have the time to correct/annotate your code...

In JPOSServer :-

a) Isetup a MUX - just one - start it and leave it alone to do it's job,
certainly don't start a new MUX for each JPOSServer.sendRequest.

b) Make sure the default matching keys meet your needs (11,41) which
currently seems ok in your test code - but might vary with time/interface.

c) When the ISOMsg arrives to process it, just do that and use the
ISOSource provided to send your response to, you don't need to save to
save that source or use it for anything other than responding in your
.process method.

d) You really need one Channel (that the MUX handles) - just one
(probably) initiate it when you do the MUX (just the one - see point a)

In JPOSClient :-

What keeps the JPOSClient 'alive' it is a main class that connects sends
and stops?


Generally :-

i) sort out your descriptions/usage of 'client' and 'server'
participants. In the code provided the JPOSClient is sending building
and sending the 0800; I think you said the server was?


In summary I would suggest you look at jpos-ee (Q2 as was) and make use
of it's module based approach (if you aren't already).


I hope this helps get you going.

--
Mark

Didik Hari

unread,
Dec 10, 2014, 9:40:03 PM12/10/14
to jpos-...@googlegroups.com
Hi Mark,
Thanks for your response.

No, im not the server owner, i just act as client.

I have solve my problems by changing my code.
first, i create new JPos project base xml (Q2) and then i know that xml that define channelAdaptor, MUX is on singleton scope.
then, i change my code before like this (example for getting isoMux):

private static ISOMUX getIsoMux(String billingProvider, ISOChannel channel){
    String key = "isoMux-"+billingProvider;
    ISOMUX isoMux = (ISOMUX) NameRegistrar.getIfExists(key);
    if (isoMux == null) {
        isoMux = new ISOMUX(channel) {
            @Override
            protected String getKey(ISOMsg m) throws ISOException {
                return super.getKey(m);
            }
        };
        NameRegistrar.register(key, isoMux);
    }
    return isoMux;
}

and i define method with logic like that to get channel and packager.
then my simulator work well.

my reason for using java code is because i want to use JPos as a library on WebMethods service, and i want to create Jpos client service, so i can pass the IP and Port, create MUX, Channel, Packager and register it in singleton scope base on billingProvider (as a key).
How do you think about it Mark? Please give advice,

Thank you Mark.


--
--
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 a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/YuWsr8HiKMM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/54888CEA.1070509%40talktalk.net.
For more options, visit https://groups.google.com/d/optout.

Alejandro Revilla

unread,
Dec 11, 2014, 6:06:43 AM12/11/14
to jPOS Users
I don't think this is going to fly, I don't recommend using ISOMUX, we have QMUX now that's much better. In addition, you're not starting the ISOMUXes you're creating, so it won't work, but don't just add the start there, I'm afraid you'll end up with a ton of threads during the life-cycle of your application. Go for a Q2/QMUX approach, that's the way to go.



Reply all
Reply to author
Forward
0 new messages