So if I am a client, I would configure as many channel deploy files as the number of connections you want to the server.
Each channel will have a mux associated with it. Wrap all these muxes in a jpos muxpool deploy. This will act as a single huge mux that does round robin selection of the mux and hence the channel. Use the muxpool to send the request (its exactly the same as using the mux). This way all your connections get utilized and if any of your connections are not connected, the pool is smart enough to use the next available mux that is connected.
e.g.
Say server is listening on port 9000 and allows 2 connections.
I would create 2 channel adapters as follows, both pointing to the host and port 9000. Do see how each has an in/out element.
<?xml version="1.0" ?>
<channel-adaptor name='HostConnection-1'
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class=" org.jpos.iso.channel.NACChannel" logger="Q2" realm="channel-1"
packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/host-packager.xml" />
<property name="host" value='127.0.0.1' />
<property name="port" value="9000" />
<property name="timeout" value="1000000" />
<property name="keep-alive" value="true" />
</channel>
<in>host1-send</in>
<out>host-receive</out>
<reconnect-delay>10000</reconnect-delay>
<channel-adaptor name='HostConnection-2'
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class=" org.jpos.iso.channel.NACChannel" logger="Q2" realm="channel-2"
packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="cfg/host-packager.xml" />
<property name="host" value='127.0.0.1' />
<property name="port" value="9000" />
<property name="timeout" value="1000000" />
<property name="keep-alive" value="true" />
</channel>
<in>host2-send</in>
<out>host2-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
Now create 2 muxes. The muxes wire the channels in/out to its in/out
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="host-mux-1">
<in>host1-receive</in>
<out>host11-send</out>
<ready>HostConnection-1.ready</ready> <!-- needs to be adaptor name + .ready-->
<unhandled>host-unhandled</unhandled>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="host-mux-2">
<in>host2-receive</in>
<out>host12-send</out>
<ready>HostConnection-2.ready</ready> <!-- needs to be adaptor name + .ready-->
<unhandled>host-unhandled</unhandled>
</mux>
Now create a muxpool deploy file.
<mux class="org.jpos.q2.iso.MUXPool" logger="Q2" name="host-mux">
<muxes>host-mux-1 host-mux-1</muxes>
<strategy>round-robin</strategy>
</mux>
Get the muxpool by name from the jpos' nameregistrar instance and fire the request. It uses the muxes configured in pool to fire requests in a round robin way.
When its a small number of connection, this works well, as the number grows, you may want to programatically consider creating these channels and muxes.