TCP/IP multiple host and port numbers

91 views
Skip to first unread message

James Loveday

unread,
Aug 3, 2022, 5:00:38 AM8/3/22
to jPOS Users
Guys I really need your input again 

I have a requirement to connect to a client using Hex over TCP/IP 

In this case they have a primary and secondary where the transactions flow in round-robin fashion to the client, if any connection fails then all transactions need to direct to the single connection that is alive for the duration that the other connection is down. 

I have some config that uses the channel adaptor and sets a channel and I have an idea that we can use a participant class to obtain the channel adaptor and swap the host and port as needed but my head tells me this is a bad idea as TCP/IP was never meant to have that level of flexibility. 

Any advice you can give me here would be welcomed. 

Sumeet Phadnis

unread,
Aug 3, 2022, 7:49:35 AM8/3/22
to jpos-...@googlegroups.com
MUXPool is your friend.

--
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/27440b8e-fbad-401a-8577-f522aec0c48bn%40googlegroups.com.

murtuza chhil

unread,
Aug 4, 2022, 7:36:35 AM8/4/22
to jPOS Users

Define your channel deploys [channel1…channelN] with IP:port.
Define a mux for each channel [mux1…muxN]
Define a muxpool and configure it with your muxes

<mux class="org.jpos.q2.iso.MUXPool" logger="Q2" name="my-muxpool">
 <muxes>mux1 mux2 .... muxN</muxes>
 <strategy>round-robin</strategy>
</mux>

strategy can be one of the following
https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/q2/iso/MUXPool.java#L222-L229

Now get the muxpool from the nameregistrar as you would do for the mux QMux.getMux(“my-muxpool”).
Use the muxpool to send the request (Qmux and Muxpool both implement Mux).. It will send it based on the strategy configured.

-chhil

James Loveday

unread,
Sep 16, 2022, 4:55:24 AM9/16/22
to jPOS Users
Thanks Chhil that worked perfectly. 
Reply all
Reply to author
Forward
0 new messages