Creating another customized packager for all incoming request using MUX. My outgoing request works with no issue

ぐ巨炮叔叔 提交于 2021-01-28 13:32:37

问题


I have a jpos implementation that sends and receives iso messages. It first requires sign-on before anything else. As a client, i am able to send request (customized.xml packager) and also receive response successfully with no issue.

However, when the other party sends request to me, the same packager (customized.xml packager) is unable to unpack the request received.

To try to resolve issue with incoming request, i decided to create a new customized packager (customized2.xml) but i noticed all incoming request are still referring to the old packager (customized.xml). How do i handle this or what's the best practise to go about it.

My configurations:

10_mychannel.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <channel-adaptor name="mychannel-channel" logger="Q2">
       <channel class="org.jpos.iso.channel.ASCIIChannel" type="client" connect="yes" logger="Q2" realm="post-channel" packager="org.jpos.iso.packager.GenericPackager">
          <property name="packager-config" value="cfg/customized.xml" />
          <property name="packager-logger" value="Q2" />
          <property name="packager-realm" value="custom-packager" />
          <property name="host" value="14.101.333.111" />
          <property name="port" value="7777" />
          <property name="length-digits" value="6" />
          <property name="connection-timeout" value="30000" />
          <property name="timeout" value="300000" />
       </channel>
       <in>my-channel-send</in>
      <out>my-channel-receive</out>
       <reconnect-delay>10000</reconnect-delay>
       <keep-alive>yes</keep-alive>
    </channel-adaptor>

20_my_mux.xml

    <mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="my-mux">
    <in>my-channel-receive</in>
    <out>my-channel-send</out>
    <ready>my-channel.ready</ready>
    </mux>

21_my_q_beans.xml

    <qbean name='LogonManager' class='com.my.processor.LogonManager' />

50_my_server.xml

    <server class="org.jpos.q2.iso.QServer" logger="Q2" name="xml-server-7777" realm="xml-server-7777">
      <attr name="port" type="java.lang.Integer">7777</attr>
      <channel class="org.jpos.iso.channel.ASCIIChannel" packager="org.jpos.iso.packager.GenericPackager" type="server" logger="Q2" realm="xml-server-7777">
      <property name="packager-config" value="cfg/customized2.xml" />
      <property name="timeout" value="180000"/>
      </channel>
      <request-listener class="com.my.processor.myListener" logger="Q2" realm="incoming-request-listener" />
    </server>

incoming sample request

    public class myListener implements ISORequestListener{

        private static final String FTREQUEST = "1200";
        private static final String REVADVICE = "1420";
        private static final String NETWORKREQ = "1804";

        Log log1;

        @Override
        public boolean process(ISOSource source, ISOMsg m) {
            System.out.println("::::: Waiting :::::");
            log.info("::::: Inside  Listener :::::");
            try {
                String mti = m.getMTI();
                System.out.println("mti ::: " + mti);
                log.info("mti ::: " + mti);
                switch (mti) {
                    case FTREQUEST:
                        log.info("Inside Financial Transaction Request");
                        //implementation here 

                        m.setMTI("1210");
                        m.set(2, m.getString(2));
                        m.set(3, m.getString(3));
                        m.set(4, m.getString(4));
                        m.set(11, m.getString(11));
                        m.set(12, m.getString(12));
                        m.set(39, "100");
                        source.send(m);

                        break;
                    case REVADVICE:
                        log.info("Reversal Advice");
                        break;
                    case NETWORKREQ:
                        log.info("Network Management Request");
                        break;
                }

            } catch (Exception ex) {
                ex.printStackTrace(System.out);
            }
            return true;
        }
    }

来源:https://stackoverflow.com/questions/64439538/creating-another-customized-packager-for-all-incoming-request-using-mux-my-outg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!