MuxPool Usage Guidance

113 views
Skip to first unread message

JTO

unread,
Nov 16, 2009, 2:25:22 PM11/16/09
to jPOS Users
Hi guys,

I am attemping to use a MuxPool and must be missing a connection (in
my head) somewhere but I have been unable to isolate where. I think it
is just my understanding of the MuxPool and hopefully someone has
implemented one and can show me the light.

I have a channel coming in, passing the TXN to a TransactionManager,
which is then passed to a particpant. In the participant routine the
message comes to sendResponse. The message times out and is never
returned. I thought it was because the muxes (and MuxPool) always
return false to isConnected(). After further testing, if I change my
TxnMgr configuration it works, so now I am really lost. ANy ideas on
what I am doing wrong?

( <property name="targetMux" value="BAL_Mux_Primary" /> ) <<< This
works, direct to Mux

( <property name="targetMux" value="MuxPool" /> ) <<< This never
returns from MuxPool

--- name-registrar ---
mux.MuxPool: org.jpos.q2.iso.MUXPool

mux.BAL_Mux_StandIn: org.jpos.q2.iso.QMUX
tx=0, rx=0, tx_expired=0, tx_pending=0, rx_expired=0,
rx_pending=0, rx_unhandled=0, rx_forwarded=0, connected=false, last=0

mux.BAL_Mux_Primary: org.jpos.q2.iso.QMUX
tx=0, rx=0, tx_expired=0, tx_pending=0, rx_expired=0,
rx_pending=0, rx_unhandled=0, rx_forwarded=0, connected=false, last=0

mux.BAL_Mux_Secondary: org.jpos.q2.iso.QMUX
tx=0, rx=0, tx_expired=0, tx_pending=0, rx_expired=0, rx_pending=0,
rx_unhandled=0, rx_forwarded=0, connected=false, last=0

BE-Test-03: org.jpos.q2.iso.ChannelAdaptor
tx=0, rx=0, connects=1, last=0
BE-Test-02: org.jpos.q2.iso.ChannelAdaptor
tx=0, rx=0, connects=1, last=0
logger.Log-CC: org.jpos.util.Logger
BE-Test-01: org.jpos.q2.iso.ChannelAdaptor
tx=0, rx=0, connects=1, last=0

I have included a snippet of the code

private void sendResponse(long id, Context ctx) {

ISOMsg response=null;
ISOSource source = (ISOSource) ctx.get("source");
ISOMsg resp = (ISOMsg) ctx.get( cfg.get("queue"));
ISOMsg req = (ISOMsg) resp.clone();
ISOMsg convertedRequest = (ISOMsg) resp.clone();

if (source == null || !source.isConnected())
{
return; // too late . . .
}

try {
// This was done because no getMux() exists in Mux.java
MUX pooledMux = (MUX) NameRegistrar.get ("mux."+ cfg.get
("targetMux", "noTargetMux"));

// This always returns false, why?
pooledMux.isConnected();

// Always times out because no muxes appear to be available
(isConnected()=false)
response = pooledMux.request(req, cfg.getLong("timeout",25000 ));

if (source != null && source.isConnected() && response != null)
{
source.send(response);
}else{
convertedRequest.setDirection(ISOMsg.OUTGOING);
source.send(errorMsg(source, convertedRequest));
}
} catch (Exception t)
{
Logger.log(new LogEvent((LogSource) this,"Exception in sendReponse",
e));
}
}
}

Alejandro Revilla

unread,
Nov 16, 2009, 8:05:48 PM11/16/09
to jpos-...@googlegroups.com
MUXPool.isConnected is implemented like this:

    public boolean isConnected() {
        for (int i=0; i<mux.length; i++)
            if (mux[i].isConnected())
                return true;
        return false;
    }

So you need to figure out why your children MUXes are returning false.

Have you defined a '<ready>...</ready>' element in your children mux config?

i.e in mux.BAL_Mux_Primary config:

   <ready>BE-Test-01.ready</ready>

--Alejandro


JTO

unread,
Nov 16, 2009, 10:22:43 PM11/16/09
to jPOS Users
Alejandro,

My 3 muxes looks like this:

<mux class="org.jpos.q2.iso.QMUX" name="BAL_Mux_Primary">
<key>11</key>
<in>BAL_1.receive</in>
<out>BAL_1.send</out>
<ready>BAL_1.ready</ready>
<unhandled>BAL.unhandled</unhandled>
</mux>

The only difference would be the names (PRIMARY,SECONDARY,ETC...) and
the number folling the underscore (BAL_X)

The muxpool looks like this:

<mux class="org.jpos.q2.iso.MUXPool" name="MuxPool">
<muxes>BAL_Mux_Primary BAL_Mux_Secondary BAL_Mux_StandIn</muxes>
<strategy>primary</strategy>
</mux>

As shown in my previous post of the System_Monitor all of the muxes
show connected = 0 but if I have my transactionManager send it to one
of them they work. I am at wits end....

Thanks,

-John

Alejandro Revilla

unread,
Nov 17, 2009, 4:08:13 AM11/17/09
to jpos-...@googlegroups.com
What about the channel names, is it "BAL_1" ? remember that the 'ready' indicator is named after channelName+".ready", so in this case, the channel has to be called "BAL_1.ready". Is that the case?

AAO

unread,
Nov 17, 2009, 8:26:26 AM11/17/09
to jpos-...@googlegroups.com
Johnny -

What about the way these deploy items are named/numbered?

Channel needs to load first, then mux, then mux pool. 

In our configuration we go 10_xxx for channels, 20_xxx for Muxes and 25_xxx for mux pool.

Andy Orrock


--
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

JTO

unread,
Nov 17, 2009, 10:53:45 AM11/17/09
to jPOS Users
THANKS!!!

I missed that my channelnames were not matching. I thought that the
READY was using the (<ready>BAL_3.ready</ready> ) and not actually the
channelName (<channel-adaptor name='BE-BAL-3'
class="org.jpos.q2.iso.ChannelAdaptor">). I aligned the two and ll is
well now.

I new it was something I was overlooking, thank you again!.

-John
> > </mux>- Hide quoted text -
>
> - Show quoted text -

JTO

unread,
Nov 17, 2009, 10:55:30 AM11/17/09
to jPOS Users
Andy,

Thanks for the suggestion, I have always named (except when I am
playing around) my nodes that way as I learned from you guys long ago
on that one.....

-John

On Nov 17, 7:26 am, AAO <aaorr...@gmail.com> wrote:
> Johnny -
>
> What about the way these deploy items are named/numbered?
>
> Channel needs to load first, then mux, then mux pool.
>
> In our configuration we go 10_xxx for channels, 20_xxx for Muxes and 25_xxx
> for mux pool.
>
> Andy Orrock
>
>
>
> On Tue, Nov 17, 2009 at 03:08, Alejandro Revilla <a...@jpos.org> wrote:
> > What about the channel names, is it "BAL_1" ? remember that the 'ready'
> > indicator is named after channelName+".ready", so in this case, the channel
> > has to be called "BAL_1.ready". Is that the case?
>
> > On Tue, Nov 17, 2009 at 1:22 AM, JTO <j...@johnoverland.com> wrote:
>
> >> Alejandro,
>
> >> My 3 muxes looks like this:
>
> >> <mux class="org.jpos.q2.iso.QMUX" name="BAL_Mux_Primary">
> >>  <key>11</key>
> >>  <in>BAL_1.receive</in>
> >>  <out>BAL_1.send</out>
> >>  <ready>BAL_1.ready</ready>
> >>  <unhandled>BAL.unhandled</unhandled>
> >> </mux>
>
> >>  --
> > You received this message because you are subscribed to the "jPOS Users"
> > group.
> > Please seehttp://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<jpos-users%2Bunsubscribe@googlegrou­ps.com>
> > For more options, visit this group at
> >http://groups.google.com/group/jpos-users- Hide quoted text -

Alejandro Revilla

unread,
Nov 17, 2009, 11:07:03 AM11/17/09
to jpos-...@googlegroups.com
You're welcome.

Andy's observation related the deploy order is a good one to always take into account.
Reply all
Reply to author
Forward
0 new messages