Skip to content

Commit

Permalink
Re-include QMUX notifications for FSDISOMsg
Browse files Browse the repository at this point in the history
Commit aac64d3 results in the inability to use QMUX e.g for FSDISOMsg
messages that do not have MTI compliant with the ISO 8583 standard.

QMUX uses field 0 as mandatory. Therefore, in the FSDISOMsg messages
it is necessary to map elements that do not have to be MTI. In this
case, the m.isResponse() method can throws an ArrayIndexOutOfBoundsException.

However, this can be hot-fixed by enabling the "return-rejects" parameter
but a better solution is to include it in the code.
  • Loading branch information
demsey committed Mar 29, 2019
1 parent 3d0dee3 commit 0e0b8e8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion jpos/src/main/java/org/jpos/q2/iso/QMUX.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,28 @@ public void request (ISOMsg m, long timeout, ISOResponseListener rl, Object hand
sp.out (out, m);
synchronized (this) { tx++; rxPending++; }
}

protected boolean isNotifyEligible(ISOMsg msg) {
if (returnRejects)
return true;

try {
return msg.isResponse();
} catch (RuntimeException | ISOException ex) {
// * ArrayIndexOutOfBoundsException - It may occur for messages where
// MTI is not standard 4 characters (eg. FSDISOMsg), then notification is expected.
// * ISOException: When there is no field 0, the error should be logged
return true;
}
}

@Override
public void notify (Object k, Object value) {
Object obj = sp.inp (k);
if (obj instanceof ISOMsg) {
ISOMsg m = (ISOMsg) obj;
try {
if (returnRejects || m.isResponse()) {
if (isNotifyEligible(m)) {
String key = getKey (m);
String req = key + ".req";
Object r = isp.inp (req);
Expand Down

0 comments on commit 0e0b8e8

Please sign in to comment.