kpavlov / jreactive-8583

Kotlin/Java Client & Server for ISO8583 & Netty
Apache License 2.0
321 stars 147 forks source link

Sending request message but not receiving server response #153

Open thoni-miguel opened 1 year ago

thoni-miguel commented 1 year ago

I'm having an issue where im sending an iso message and expecting another one in return, but the problem is, it never arrives. I found out that the problem is probably caused when there is a fragmentation on the expected iso response. We were using the 0.2.1 version before, but we did an upgrade to the latest version (1.4.1) and since then we've been having this issue. I'm sending the old code block we were using, and the new one. Is there something missing that could be causing this issue?

old one:

     ChannelPipeline channelPipeline = socketChannel.pipeline();
      channelPipeline.addLast(new HeaderSplitter(headerLength));
      channelPipeline.addLast(new Iso8583Decoder(messageFactory));
      channelPipeline.addLast(new Iso8583Encoder(headerLength));
      channelPipeline.addLast(new IsoMessageLoggingHandler(LogLevel.INFO));
      channelPipeline.addLast(clientHandler);
      channelPipeline.addLast(new ExceptionHandler(messageFactory));

new one:

SocketAddress socketAddress = new InetSocketAddress(fepasHostAddress, fepasPort);
final var configuration = ClientConfiguration.newBuilder().addLoggingHandler(true).build();
messageFactory = createMessageFactory();

client = new com.github.kpavlov.jreactive8583.client.Iso8583Client<IsoMessage>(socketAddress,
    configuration, messageFactory);

client.addMessageListener(clientHandler);

client.init();

ChannelFuture channelFuture = client.connect();

channelFuture.channel().pipeline().addLast(new IsoMessageLoggingHandler(LogLevel.INFO, false,
   true, IsoMessageLoggingHandler.DEFAULT_MASKED_FIELDS));
kpavlov commented 1 year ago

Hello, could you provide also an example of Iso message you're trying to send? Did you try to write an integration test for your client?

thoni-miguel commented 1 year ago

Hey! So this is an example of the iso message im trying to send: Im sending this message:

WRITE: Message: 0800A038000101C10008040000000000000091000000001315214611250401250020000000041302123       034201008339553852670146107730900017400801.39-4P001
MTI: 0x0800
  3: [Processing code:NUMERIC(6)] = '910000'
  11: [System trace audit number:NUMERIC(6)] = '000013'
  12: [Time, local transaction (hhmmss):NUMERIC(6)] = '152146'
  13: [Date, local transaction (MMDD):NUMERIC(4)] = '1125'
  32: [Acquiring institution identification code:LLVAR(4)] = '0125'
  40: [Service restriction code:NUMERIC(3)] = '002'
  41: [Card acceptor terminal identification:ALPHA(8)] = '00000000'
  42: [Card acceptor identification code:ALPHA(15)] = '41302123       '
  48: [Additional data - private:LLLVAR(34)] = '2010083395538526701461077309000174'
  61: [Reserved private:LLLVAR(8)] = '01.39-4P'
  70: [Network management information code:NUMERIC(3)] = '001'

And im expecting this one as a response:

READ: Message: 0810A038000103C1000004000000000000009100000000131521461125040125000020000000041302123       06420100833955385202044a3K236Ov8XymbgNZf99qhpTTeCdBPFl0H5oLw9Ge1JI=001
MTI: 0x0810
  3: [Processing code:NUMERIC(6)] = '910000'
  11: [System trace audit number:NUMERIC(6)] = '000013'
  12: [Time, local transaction (hhmmss):NUMERIC(6)] = '152146'
  13: [Date, local transaction (MMDD):NUMERIC(4)] = '1125'
  32: [Acquiring institution identification code:LLVAR(4)] = '0125'
  39: [Response code:ALPHA(2)] = '00'
  40: [Service restriction code:NUMERIC(3)] = '002'
  41: [Card acceptor terminal identification:ALPHA(8)] = '00000000'
  42: [Card acceptor identification code:ALPHA(15)] = '41302123       '
  48: [Additional data - private:LLLVAR(64)] = '20100833955385202044a3K236Ov8XymbgNZf99qhpTTeCdBPFl0H5oLw9Ge1JI='
  70: [Network management information code:NUMERIC(3)] = '001'

So, another interesting thing that is happening is, the same code is working for an user but its not working for another one, so we believe that its a socket fragmentation of the package issue.

And unfortunately, our project is not integration test ready yet, so i did not run any.

jstolwijk commented 4 months ago

@thoni-miguel I've observed similar issues, are you still facing these issues and if not how did you solve it?