The jPOS MUX Pool
There was a good dialog between Alejandro and Alwyn today on the jPOS Users' List concerning some various aspects of Multiplexer (a.k.a., 'MUX' or 'QMUX') implementations. At one point, Alejandro advised Alwyn that to solve a particular business need, he recommended the use of a "MUX pool."
When would you want to go with a MUX Pool instead of a standard QMUX implementation? We needed it recently to address this issue: Stored Value Systems ('SVS') has a very strict and tight channel disconnect model - if there's no auth (01x0, 02x0, 03x0) or network (08x0) traffic over a particular channel for a three-and-a-half minute span, then SVS disconnects the channel. Typically, you can keep a channel alive by establishing an "echo-interval" less than the disconnect timer in your logon manager.
[Note: Refer to my On-Boarding series for set-up details of 'typical' two-channel QMUX.]
The problem is that in a standard QMUX implementation governing two channels, the logon manager will fire off an echo at the prescribed interval to one channel or another...but not necessarily both. That's a problem.
To ensure that each channel fires off within the desired interval level, we implemented a MUX Pool, whereby we set-up 'svs-mux-0' to govern one channel, and 'svs-mux-1' to govern the second channel. I suggest you print v1.1 of the On-boarding Guide, then compare it to the MUX Pool implementation, which goes like this...
You've got your two channel implementations like this (these are 10_svs_channel.xml and 10_svs_channel_1.xml respectively):
<channel-adaptor name='svs' <channel-adaptor name='svs1' Then, instead of 20_svs_mux.xml, we've got two elements - 20_svs_mux.xml and 20_svs_mux_1.xml that look like this (note how the <in> and <out> tie them to specific channels):
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="svs-mux-0"> <mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="svs-mux-1"> Then, we have a new element called the mux pool (25_svs_mux_pool.xml) which ties the muxes together in their operation: <mux class="org.jpos.q2.iso.MUXPool" logger="Q2" name="svs-mux">
And, finally, in the logon managers, we reference specific members within the MUX pool (30_svs_logon_mgr.xml and 30_svs_logon_mgr_1.xml follow...note the definition of three-minute echo intervals in order to satisfy the three-and-a-half-minute disconnect timer)... <svs-logon-mgr class="org.jpos.svs.LogonManager" logger="Q2"> <svs1-logon-mgr class="org.jpos.svs.LogonManager" logger="Q2">
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.NACChannel" logger="Q2"
realm="svs-channel"
packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/svs.xml" />
<property name="host" value="@svs0.host@" />
<property name="port" value="@svs0.port@" />
</channel>
<in>svs-send</in>
<out>svs-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.NACChannel" logger="Q2" realm="svs-channel-1"
packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/svs.xml" />
<property name="host" value="@svs1.host@" />
<property name="port" value="@svs1.port@" />
</channel>
<in>svs1-send</in>
<out>svs1-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
<in>svs-receive</in>
<out>svs-send</out>
<ready>svs.ready</ready>
<unhandled>svs-unhandled</unhandled>
<key>11, 41</key>
</mux>
<in>svs1-receive</in>
<out>svs1-send</out>
<ready>svs1.ready</ready>
<unhandled>svs-unhandled</unhandled>
<key>11, 41</key>
</mux>
<muxes>svs-mux-0 svs-mux-1</muxes>
<strategy>round-robin</strategy>
</mux>
<property name="persistent-space" value="@svs.logon.space@" />
<property name="mux" value="svs-mux-0" />
<property name="channel-ready" value="svs.ready" />
<property name="timeout" value="900000" />
<property name="echo-interval" value="180000" />
<property name="logon-interval" value="43200000" />
</svs-logon-mgr>
<property name="persistent-space" value="@svs.logon.space@" />
<property name="mux" value="svs-mux-1" />
<property name="channel-ready" value="svs1.ready" />
<property name="timeout" value="900000" />
<property name="echo-interval" value="180000" />
<property name="logon-interval" value="43200000" />
</svs1-logon-mgr>
Comments