>> This works
Good.
>> but I think I am in a wrong way.
>> Can somebody help me and point
>> where I am wrong.
What do you think is wrong?
If it works, I am sure what you need or are asking?
--
Mark
Sent from Proton Mail Android
I am new to jpos. Can somebody help me setup jpos. Currently I have VTS simulator as server and here are my qmux, channel adaptor and txn manager.<?xml version="1.0" encoding="UTF-8"?>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="mux1">
<in>receive</in>
<out>send</out>
<ready>channel1.ready</ready>
<request-listener class="org.company.AutoResponder" logger="Q2"
</request-listener>
<request-listener class="org.jpos.iso.IncomingListener" logger="Q2"
realm="incoming-request-listener">
<property name="space" value="transient:default"/>
<property name="queue" value="transaction1"/>
<property name="timeout" value="12000"/>
<property name="ctx.DESTINATION" value="jPOS-AUTORESPONDER" />
</request-listener>
</mux><?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor name="channel1" class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.ASCIIChannel" logger="Q2"
realm="visa-channel" packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="/ascii.xml"/>
<property name="host" value="192."/>
<property name="port" value="1111"/>
<property name="timeout" value="300000" /> <!-- five minutes -->
</channel>
<in>send</in>
<out>receive</out>
</channel-adaptor><?xml version="1.0" encoding="UTF-8"?>
<txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2">
<property name="space" value="transient:default"/>
<property name="queue" value="transaction1"/>
<property name="persistent-space" value="jdbm:MyTxnSpace" />
<property name="sessions" value="10"/>
<property name="max-sessions" value="128"/>
<property name="timeout" value="5000"/>
<property name="debug" value="true"/>
<participant class="com.wowfinstack.creditswitch.messaging.mux.RouteParticipant" logger="Q2"/>
<participant class="org.jpos.transaction.participant.QueryHost"/>
<participant class="org.jpos.transaction.participant.SendResponse"/>
</txnmgr>@Override
public boolean process(ISOSource source, ISOMsg isoMsg) {
try {
String spaceN = configuration.get("space");
Long timeout = configuration.getLong("timeout");
String queueN = configuration.get("queue");
Context context = new Context();
Space<String,Context> space = SpaceFactory.getSpace(spaceN);
ISOMsg res = (ISOMsg) isoMsg.clone();
source.send( res );
}
}
catch(Exception e) {
e.printStackTrace();
}
return true;
}public class RouteParticipant implements TransactionParticipant, Configurable {
private static Random rnd = new Random();
private Configuration cfg;
@Override
public void setConfiguration(Configuration configuration) throws ConfigurationException {
this.cfg = cfg;
}
@Override
public int prepare(long id, Serializable serializable) {
Context ctx = (Context) serializable;
try {
System.out.println("-----------Route Participant ----------------------");
ISOMsg m = (ISOMsg) ctx.get(REQUEST);
ISOMsg r = (ISOMsg) m.clone();
r.setResponseMTI();
r.set(39, "00");
// Put the response in the context so we can see in the debug display
ctx.put(RESPONSE, r);
ISOSource source = (ISOSource) ctx.get(SOURCE);
if(source != null && source.isConnected()) {
Thread.sleep(Math.abs(rnd.nextInt() % 4000));
source.send(r);
}
}
catch(Exception e) {
e.printStackTrace();
}
return PREPARED;
}This works but I think I am in a wrong way. Can somebody help me and point where I am wrong.--
--
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/a447dca9-80ce-4249-aaa2-5ad56cc0174fn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/4UbFYjayez6qS4oIsJ9_M-w8Q3dM-ROvNspSFdYxtqXkr2YSTRXWeK3kLd3e68s8WVRcy_rDCcgOGQoGYsoN2P3GUHFgyJRsxTXaoRQng4U%3D%40pm.me.
Sorry, by mistake I sent the last response just to Chandrasekhar. I have to configure thunderbird in this computer for not showing the reply button for lists.
I'm answering to him, but also forwarding this to the list for
context and so that my first reply is also delivered.
---
Doesn't the OP have to answer for echo messages anyway?
Also, I have noticed that the OP has two request listeners, there seems to be no need for both if you only need to send an approved response, you can send them in the request listener, or using the transaction manager, but the transaction manager code is not being called if you return true in the first one.
Also, you mey want to check if the request is indeed a request and not a response.
Another question, is your role acquirer or issuer?
Kind regards.
Alcarraz, if VTS act as server , I think his application is acquirer switch .then he has nothing to do .no need of requestListner, txn manager. Only mux and channel adopter is sufficient. He has to prepare isomsg and sending it through mux and also recieve response from VTS .
On Sat, 1 Jun, 2024, 12:39 am Andrés Alcarraz, <alca...@gmail.com> wrote:
Actually, acording to his configuration he is using the standard jpos’s
IncomingListener
so what I don’t get, is where’s theprocess
method coming from, perhaps from an unused transaction participant?As for answering the OP question, I am not sure how to do that, because there is a ton of logic to be added yet, for now you are just approving everything, so you need to add tons of logic for that, and what’s need to be done will depend on tons of things, like requirements and even your personal or the team’s personal tastes.
But you seem to be going down the right track.
My 2 cents.
El 31/05/24 a las 12:43, Chandrasekhar Rout escribió:
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAGCvrAFkF9Kjca1%2BMfvZq0H2G3pUSUPZDUiFjv6yUAiantE_Q%40mail.gmail.com.
--
Andrés Alcarraz
Andrés Alcarraz
This is what you had (I removed the auto responder you had in it).
<?xml version="1.0" encoding="UTF-8"?>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="mux1">
<in>
receive
</in>
<out>
send
</out>
<ready>
channel1.ready
</ready>
<request-listener class="org.jpos.iso.IncomingListener" logger="Q2" realm="incoming-request-listener">
<property name="space" value="transient:default" />
<property name="queue" value="transaction1" />
<property name="timeout" value="12000" />
<property name="ctx.DESTINATION" value="jPOS-AUTORESPONDER" />
</request-listener>
</mux>
The channel you have is correct (IP is partial but I assume youy were trying to hide it)
<?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor name="channel1" class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.ASCIIChannel" logger="Q2" realm="visa-channel" packager="org.jpos.iso.packager.GenericPackager">
<property name="packager-config" value="/ascii.xml" />
<property name="host" value="192." />
<property name="port" value="1111" />
<property name="timeout" value="300000" />
<!-- five minutes -->
</channel>
<in>
send
</in>
<out>
receive
</out>
</channel-adaptor>
The mux and channel in/out queues are aligned correctly.
So anything that comes in will be placed in a space with a queue transaction1
.
The listener places a “DESTINATION” key with a value of “jPOS-AUTORESPONDER”
The listener you are using is what jpos provides and is fine https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/IncomingListener.java
So now the transaction manager will start processing the request.
Your first participant in the txn mgr is RouteParticipant
What you do in there is respond back to the source that sent you the ISO request. (source.send(r);)
I don’t think you want to do that since you have a jpos queryhost and jpos SendResponse participants configured.
Your queryhost looks at the “DESTINATION” key in the context (you set the value as “jPOS-AUTORESPONDER” and looks for mux with that name).
You don’t have a mux and channels configured for your outbond, at least you have not shared it here.
If your mux and channel or server was configured queryhost would send the request out, wait for the response (see https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/transaction/participant/QueryHost.java#L83)
Then put the ISO response in the context.
Next the sendResponse participant would get called.
https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/transaction/participant/SendResponse.java#L59
This will do some checks and send the response back to who sent you the request.
Understand what you are trying to configure and do.
Implement the tutorial and understand it.
https://jpos.org/doc/tutorials/jpos-gateway.pdf
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/d4726225-7d41-4894-bf02-20f1118fa0f1n%40googlegroups.com.
Likely your AsciiChannel for Visa is incorrect.
You will most likely need https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/channel/VAPChannel.java
<channel-adaptor name='visa_xxx'
class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2" realm="visaxxx">
<channel name="visachannel.1"
class="org.jpos.iso.channel.VAPChannel"
packager="org.jpos.iso.packager.GenericPackager" logger="Q2" realm="visa.channel.1">
<property name="packager-config" value="path/to/visasms.xml" />
<property name="srcid" value="@srcid-1@" />
<property name="dstid" value="@destid-1@" />
<property name="host" value="@IP To connect to VTS@" />
<property name="port" value="@port VTS is listening on@" />
</channel>
<ignore-iso-exceptions>yes</ignore-iso-exceptions>
<in>send</in>
<out>receive</out>
</channel-adaptor>
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/9fbaeb1c-d668-4e5f-ba80-0c2139e82b74n%40googlegroups.com.
That “ implementation has some weird stuff:
ISOMsg res = (ISOMsg) isoMsg.clone();
//logic
ISOMsg objResMsg = isoParser.getMessgeObject();
ctx.put(REQUEST, objResMsg );
ctx.put(SOURCE, source);
sp.out(queue, ctx, timeout);
source.send( objResMsg );
You are putting the request in a context, and then queueing it to be processed by a transaction manager, but you are sending a bad response in the same method.
Your source.send( objResMsg );
will send the request back to the sender without any processing,
and usually you send the response in the transaction manager. I
suggest you go through the jPOS gateway tutorials before
continuing, so you understand better what you are doing.
Andrés Alcarraz
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/d4726225-7d41-4894-bf02-20f1118fa0f1n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/f5c1f450-e6ff-47c8-8029-5d32cec6ad43n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/3148274c-bef6-4b56-aca3-91b7485d6adbn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefDq%3DffL3W1ufMTXoUMk7bbUX_OL%3Dcgd-qPzyJzBhbEyLg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAEftSvTvSjknmUMD5OPRP5s8g3OuTr5sf09CswS6uGW5TeeM7Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/57de472d-8ed4-4b14-9cba-cb4e9517c191n%40googlegroups.com.
Hi Snehil.
To help you better, we need to understand more about what you are trying to achieve, perhaps you already stated that, but it may have lost to me between all the code fragments.
What do you need to do with the incoming messages? Who performs the authorization? Yourself or you have to send it to another party for authorization?
All those details will determine what you do in your transaction manager.
That said, I would
suggest not performing any logic in a custom request listener
and just use IncomingListener
, you may respond to the 0800’s in a request listener, and then
let the IncomingListener
send all the other messages to the transaction manager.
The following code makes me think you still need to understand jPOS concepts to be able to effectively develop a jPOS based application:
Your ISORequestListener
would look something like this:
public class EchoRequestListener implements ISORequestListener {
@Override
public boolean process(ISOSource source, ISOMsg isoMsg)
{
if("0800".equals(isoMsg.getMTI())) {
ISOMsg res = (ISOMsg) isoMsg.clone();
res.set(39, cfg.get("rc", "00"));
source.send(res);
return true;
} else {
return false; //so that the next request listener process the message
}
}
}
Then in your server xml:
<?xml version="1.0" encoding="UTF-8"?>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="mux1">
<in>receive</in>
<out>send</out>
<ready>channel1.ready</ready>
<request-listener class="org.company.EchoRequestListener"/> <!--process echo messages-->
<request-listener class="org.jpos.iso.IncomingListener" realm="incoming-request-listener" logger="Q2">
<property name="space" value="transient:default"/>
<property name="queue" value="transaction1"/>
<property name="timeout" value="12000"/>
<property name="ctx.DESTINATION" value="jPOS-AUTORESPONDER" /> <!-- do you really want to send your request to the jPOS autoresponder?-->
</request-listener>
</mux>
And perform any other logic in a custom participant.
I hope this will put you closer to your goal.
Andrés Alcarraz
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/57de472d-8ed4-4b14-9cba-cb4e9517c191n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/55ad8250-ba46-4aeb-bc26-f5ed2950a59bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/1919d2df-fa34-4bb0-825b-7b2228ad624cn%40googlegroups.com.
Hi Sneil, if you want to successfully implement a jPOS (or any other technology) based solution, you need to understand what is happening without asking in every step to the community, or else, it will take you ages, if it even finally works.
Your questions should be about what specifically you don’t understand from the logs or workflow, but not for us to tell you if it is OK or not because we don’t even know the specifics. Also, it is boring reading logs for others, unless we are trying to solve some interesting problem; and telling you if it is OK is not an interesting problem.
So, this is the last time I’m going to do this.
According to the log, you sent a reply approving the request:
<log realm="visa.channel.1/192. XXX.X.XX:XXXX " at="2024-06-05T16:07:28.486707900">
<send>
<isomsg direction="outgoing">
<!-- org.jpos.iso.packager.GenericPackager[packager/visa1.xml] -->
<header>16010200CF0000000000000000000000000000000000</header>
<field id="0" value="0110"/>
<field id="2" value="444400XXXXXXXXXX"/>
<field id="3" value="003000"/>
<field id="4" value="000000000100"/>
<field id="7" value="0605102228"/>
<field id="14" value="2905"/>
<field id="32" value="00000123456"/>
<field id="37" value="415710004495"/> <field id="39" value="00"/> //response
<field id="49" value="356"/>
</isomsg>
</send>
</log>
If everything matches, the VTS should have received the response. If it didn’t, there is most probably something wrong with the header, if it did, I don’t understand why you are asking since you should have seen it there.
So, next time, please try to make sense of the logs, and what you don’t understand.
Andrés Alcarraz
-----I have used RouteParticipant to handle incoming iso message. And this is what I got. Is this correct ??
<log realm="visa.channel.1/192. XXX.X.XX:XXXX " at="2024-06-05T16:07:28.48670790<log realm="visa.channel.1/192. XXX.X.XX:XXXX " at="2024-06-05T16:07:28.486707900">
<send>
<isomsg direction="outgoing">
<!-- org.jpos.iso.packager.GenericPackager[packager/visa1.xml] --><log realm="visa.channel.1/192. XXX.X.XX:XXXX " at="2024-06-05T16:07:28.486707900">
visa1.xml] -->
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/1919d2df-fa34-4bb0-825b-7b2228ad624cn%40googlegroups.com.
According to the log, you sent a reply approving the request:
I see a response, but expect VTS disliked it - no response code (as a for instance).
Time for the OP to share what they are trying to do in what role - otherwise we are configuring a jpos instance on a mailing list - blindly :-D
--
Mark
--
--
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/c45a3cdd-606c-4a17-aeaa-6633a6e9bf4c%40protonmail.com.
--
--
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/c45a3cdd-606c-4a17-aeaa-6633a6e9bf4c%40protonmail.com.
No need to apologise! We now just need the OP to share their intentions.
--
Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAACHDe1BPFefXKr7XzxW-oR40QF7-87iGxMAcnCv9Yn-Tnhu%3DQ%40mail.gmail.com.
Without de38, vts still wont like it.
I agree though, over to Snehil to share the details and information already requested but not given.
--
Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/6ed9f89d-dafe-4005-b077-456dd3701a85n%40googlegroups.com.