Hi,
I'm experiencing an issue with the tcp outbound gateway. This is used to integrate my application with a third party application service running on the same server. The third party respond with an xml for my xml request. Below is the gateway configuration.
The deserializer code executed in the reply is as follows. It checks the end tag of the xml response to close the stream and return the response to further processing.Code:<int-ip:tcp-connection-factory id="connectionFactory" deserializer="deserializer" host="${socket.host}" port="${socket.port}" pool-size="100" single-use="false" so-keep-alive="true" type="client" so-timeout="20000" /> <int-ip:tcp-outbound-gateway id="gateway" request-channel="sendStringMessageChannel" reply-channel="recieveStringMessageChannel" connection-factory="connectionFactory" request-timeout="10000" reply-timeout="10000" />
The issue is when put under load and when the limit of the pool is reached it begins to throws following errors.Code:public String deserialize(InputStream inputStream) throws IOException { BufferedReader br = null; StringBuilder sb = null; String str = null; try { br = new BufferedReader(new InputStreamReader(inputStream)); sb = new StringBuilder(br.readLine()); while (br.ready()) { str = br.readLine(); sb.append(str); if (str != null && str.contains("</msg>")) { break; } } return sb.toString(); } catch (Exception e) { throw new RuntimeException(e); } finally { if (br != null) { br.close(); } } }
Code:[ERROR] Failed to send or receive org.springframework.integration.MessagingException: Failed to send or receive at org.springframework.integration.ip.tcp.TcpOutboundGateway.handleRequestMessage(TcpOutboundGateway.java:120) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:97) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)When I check the threads using VisualVM I see this number of threads were created but those never get killed.Code:2012-10-19 14:20:55.989 TcpOutboundGateway [ERROR] Tcp Gateway exception java.net.SocketException: Socket closed at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116) at java.net.SocketOutputStream.write(SocketOutputStream.java:132)
I'm really stuck at this point being unable to tweak it any further to fix the issue. Is there a flow in the configuration? or has any important setting missing or contradictory setting is used?
SI version is 2.1.0.
Thanks in advance for any help or insight into issues related to this.
Sameera


Reply With Quote
