Questions related to channel-adapter/Mux and managing a client based socket application

318 views
Skip to first unread message

Adnan Sohail

unread,
Sep 4, 2019, 5:01:17 AM9/4/19
to jPOS Users
I have written below channel-adapter, it's associated mux and the transaction manager. This is setup is working fine but I want to know that how can I:
  1. Catch events like channel connected/disconnected, so that an email notification can be generated to operations team to look into the matter.
  2. Add multiple channels to the same MUX (I think, this is against the jPOS design).
  3. Monitor state of all channels to send echo/sign-on messages. Is there any ChannelFactory or MuxFactory? If so, how can I get that?


A) Channel Adapter

<channel-adaptor name='visa-client-channel' class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">


<channel class="org.jpos.iso.channel.VAPChannel" packager="org.jpos.iso.packager.Base1Packager">

<property name="packager-config" value="cfg/packager/base1.xml" />

<property name="header-format" value="2" />

<property name="host" value="192.168.1.219" />

<property name="port" value="9500" />

<property name="keep-alive" value="true" />

</channel>


<in>channel-send</in>

<out>channel-receive</out>

<reconnect-delay>10000</reconnect-delay>


</channel-adaptor>


B) Client Manager

<txnmgr name="ClientMsgManager" logger="Q2">

<property name="queue" value="TXNMGR.client" />

<property name="sessions" value="2" />

<property name="max-sessions" value="128" />

<property name="debug" value="true" />


<participant class="test.jpos.manager.MessageManager" />


</txnmgr>


C) Client MUX

<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="VisaClientMux">


<key>42 41 11</key> <!-- overrides default key to be used for all messages -->

<key mti="0800">41</key> <!-- overrides default key to be used for 0800 messages -->


<in>channel-receive</in>

<out>channel-send</out>

<ready>visa-client-channel.ready</ready>


<request-listener class="org.jpos.iso.IncomingListener" logger="Q2" realm="incoming-request-listener">

<property name="queue" value="TXNMGR.client" />

<!--

<property name="ctx.STATION" value="192.168.1.219" />

<property name="ctx.PORT" value="9500" />

-->

<property name="space" value="tspace:default" />

</request-listener>


</mux>


Regards,
Adnan Sohail

chhil

unread,
Sep 4, 2019, 5:33:15 AM9/4/19
to jpos-...@googlegroups.com

1>
Channels are Observable so you can write your obeserver and get notified. Though the notifyObservers doesn't indicate if its a connect or a disconnect (based on my understanding)you can use the mux.isconnected to determine if its connected or not at the time of notification.

2>
We use a muxpool that contains multiple muxes with each mux attached to a channel. The muxpool.send round robins or one of the other modes that can be defined.


You can write a qbean that does the echo/logon per channel. The channel is connected can be done by checking if the ready used by the mux is in the space, if its there its connected else it's not. You can use this readykey in conjunction with echo and logon, by setting a space entry with something like logonReady and echoready and provide a timeout based on when you want to do it next. You can poll for the expiry and on expiry send the respective message.

-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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/b0c5a865-b9e6-4f8c-ad30-2633e5c54761%40googlegroups.com.

Adnan Sohail

unread,
Sep 4, 2019, 6:00:40 AM9/4/19
to jPOS Users
Thanks for your cents.

I have also reached to a conclusion that qbeans are the best way to manage sign-on/sign-off/echo messages. But the questions arise, if there would be multiple channels, do I deliberately need to get each channel by its name or is there a way to get a list of connected channels?

To the first question, how an Observer can be added to a ChannelAdapter?

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

chhil

unread,
Sep 4, 2019, 6:37:11 AM9/4/19
to jpos-...@googlegroups.com
We do one Qbean and pass in the mux name and additional properties through configuration, so if I have N channels, means N muxes, and I want to signon/echo on N of these, I would have N deploy files for the Qbean.


-chhil 

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/9c2a6309-8268-4941-9ed2-eea66a99a274%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages