I know it is a similar problem to: Spring Integration. Unknown host and tcp-connection-factory
However, in my particular case the tcp-connection is established based on the si message flow. I am writing a program that "fakes" a user login to a particular site through tcp/ip connection. The host/port changes weekly so I prefer to dynamically set-up the connections. Hence, those host/ip for the destination server is not static.
I am still wondering whether there is any methods other than the [dynamic ftp sample] which set-up a whole new applicationContext for each tcp/ip connection and modifying the connection-factory which is non-trivial work.
My ideal case is:
<int-ip:tcp-outbound-gateway id="outGateway"
request-channel="input"
reply-channel="clientBytes2StringChannel"
connection-factory="client"
connection-host="#{headers.dest.host}"
connection-port="#{headers.dest.port}"
request-timeout="10000"
reply-timeout="10000"/>
<int-ip:tcp-connection-factory id="client"
type="client"
host="#{headers.dest.host}"
port="#{headers.dest.port}"
single-use="true"
so-timeout="10000"/>
Where the destination host and port is inside the message header.
I know my use-case is rare but it's extremely useful in my particular business logic. My whole webapp runs based on the messages from those raw tcp-ip connections.