Multi Channel Mux with Logon States and Echos

148 views
Skip to first unread message

Mubashar Ahmad

unread,
Aug 3, 2017, 3:05:21 AM8/3/17
to jPOS Users
Hi All

I am designing this application which connects to a host where the requirement of the host are following
  1. application will connect to two tcp ports to increase the network availability. 
  2. Host requires us to perform Logon and Key Exchange and this will be maintained on the application level 
To satisfy above requirement I came up with following design 




I was planning to use two separate ConnectionAdaptors (providing queues are thread safe) however I recently realized that I can also use MultiSessionChannelAdaptor. It was all seems alright however recently I was given following requirements to incorporate in above design. 
  1. Each link has to send and/or receive Echo request/response. 
  2. Echo request/response will depend on the Logon states
  3. If both channel have not received Echo request or response then update the logon status back in mux. 
Challenge:

Since Echos can be sent only if the both parties has been exchanged logon messages (and/or Echo response will be responded with 00 only if both parties have exchanged logons) So the echo timers and its states has to be maintained on the mux level and Echos messages must be triggered by the Mux. But there is no way for mux to dictate if a certain message has to go through a certain channel only. 

Proposed Solution:

Use an unused field of ISOMsg as a channel selector only for echo messages and provide custom implementation of MultiSessionChannelAdaptor or ConnectionAdaptor to route echo messages to specific channel based on the selector field and unset the selector field after selection of the channel. Same while receiving echo request or response that custom channel adaptor will add channel identifier in the same field before passing it back to mux. 

My Question for you is "Is there any better way to achieve this"


Regards
Mubashar 

chhil

unread,
Aug 3, 2017, 3:35:18 AM8/3/17
to jpos-...@googlegroups.com

This is some of what we do: 
Each mux is associated with a channel adaptor. So if I have 5 outbound connections I will have mux1 to mux5

Have a qbean for each mux that runs at specific time intervals to do your network messages (use the mux to send/receive). This makes sure each of your channels are doing the logon/echo/network messages, which prevents remote from disconnecting your channels. 
Based on the responses or no responses you can set the state (allow transactions or not) for a channel. Use a space variable which is shared on the VM to manage if transactions are allowed or not. This gets tricky if you have multiple machines, in that case find some means to share values via remote spaces/db/memcache whatever works for you. We use the db.
Now you will need to extend the muxpool and override the isConnected method to incorporate the usage of the additional state of the channel, so you can decide if traffic on a channel can be sent or not (we havent done this part but it seems logical :)) 

For normal round robin processing, configure a muxpool with all the muxes in it. This will make sure the financial requests (not network) 
are sent in a round robin fashion (mux pool takes care of that or uses the strategy that you configure).

The reason we chose this approach

Others on the list can feel free to correct or improve what I have stated.

-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
---
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+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cd5384d2-a83b-4034-81e1-1d76629ad8e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mubashar Ahmad

unread,
Aug 3, 2017, 8:11:40 PM8/3/17
to jPOS Users
Hi Chhil

I forgot to mention on of the most important requirement and that is Host may send response through channel-2 for a request sent to channel-1 so this is why I tend to use MutliSessionChannelAdaptor. Secondly I tried to elaborate that there is different requirement for logon/key exchange messages and echo messages. Echo has to be handled on each channel however logon state is for the whole application.  

So one Idea I am getting from your response is to override the mux to handle the Logon/Key Exchange reqeust/response (which I been doing earlier) and Override a channel to handle the echos and use the spaces to share the states with each other. 
Please comment or advise. Thanks

Mubashar
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

chhil

unread,
Aug 4, 2017, 2:06:57 AM8/4/17
to jpos-...@googlegroups.com

If the host sends responses on a different channel than the one received I think the mux wont be able to handle it (I am not 100% sure, needs verification). Plus I am not sure how the multi session adaptor will solve that problem for you.

For echoes have individual beans that handle the request response per mux (channel), though if the response is not on the same channel you will need to think about that. And use a jpos space variable to keep its state.

For logons, use the mux pool to send the request as it needs to be done on one channel and its recognized system wide. And use a jpos space variable to keep state.

Now in the mux override the isconnected based on the the channel actually connected and the state variables.

Not sure why you want to override the channel, unless of course the existing channel don't fit your needs. 
Any time  you send a request be it through mux pool or mux (they are kind of identical as they implement the same interface) you would check for isConnected() before sending message through. However you want to make sure that the network messages get through without the dependency of the state variables and the financial messages use the state variables. Which implies your isconnected method needs to be aware of the MTI of the message being sent.

If you are not on the jpos slack channel, you probably want to be on it. You may get better advice there. You can let Alejandro know you want to join the jpos slack channel and he will send you an invite.

-chhil



To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages