I'm trying to implement the following scenario using Spring Integration:
- I need to connect to a server via TCP IP and process messages received.
- I need to send messages to the same server from which receive and process responses.
This is my config:
<channel id="input">
<interceptors>
<wire-tap channel="logger"/>
</interceptors>
</channel>
<logging-channel-adapter id="logger" level="DEBUG" log-full-message="true"/>
<ip:tcp-connection-factory id="factory" type="client" host="localhost" port="9004" single-use="false"
using-nio="true" deserializer="javaDeserializer"/>
<ip:tcp-inbound-channel-adapter id="inbound" channel="input" connection-factory="factory" client-mode="true"
retry-interval="5000"/>
I can receive messages sent from the server, but I have no idea how to convert a string. javaDeserializer is not invoked when messages arrive.
2014-01-19 05:47:20 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
2014-01-19 05:47:20 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
2014-01-19 05:47:25 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
2014-01-19 05:47:25 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
2014-01-19 05:47:30 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
2014-01-19 05:47:30 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
2014-01-19 05:47:35 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
2014-01-19 05:47:35 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
With this example, you can send messages and process the reply from the server, but the connection will close and not kept listening to the messages from the server. Any idea how to solve this?
Thanks in advance.
Eduardo
jstack
orVisualVM
) to see what the threads are doing. – Gary Russell