1

My application has a requirement to send a string to a host and receive host's response through TCP socket communication. I have done it in plain Java socket programming. I want to do the same using spring integration. I used TCP Outbound Gateway as am expecting response immediately from server through same socket. My request is reaching the server, but it seems the server's response is not reaching replyChannel. Gateway is getting timed out after sometime.

Spring Configuration file:

<int:publish-subscribe-channel id="tcpChannel" />

<int-ip:tcp-connection-factory id="cfClient"
type="client"
host="localhost"
port="8376"
single-use="false"
so-timeout="30000"
connect-timeout="120"/>

<int-ip:tcp-outbound-gateway id="outGateway"
request-channel="tcpChannel"
connection-factory="cfClient"
request-timeout="10000"
remote-timeout="10000"/>
                              
<int:channel id="replyChannel"/>

<int:service-activator input-channel="replyChannel" ref="rs2GatewayListener" method="replyHandler">
</int:service-activator>

Message Gateway:

@MessagingGateway(name="tcpMsgGateway", defaultRequestChannel = "tcpChannel")
public interface Rs2TCPMessagingGateway {
  @Gateway
  String sendISOMessage(Message<String> isoMsg);
}

replyHanlder method is never invoked. Am I missing something here. Do I need to use any serializer and deserializers. Any suggestions would be appreciated.

0 Answers0