2015-07-21 82 views
2

获得我知道这是一个类似的问题: Spring Integration. Unknown host and tcp-connection-factorySpring集成 - TCP连接的客户端 - 主机/端口的消息

然而,在我的特殊情况下,TCP连接基础上,SI消息流建立。我正在编写一个程序,通过tcp/ip连接“伪造”用户登录到特定的站点。主机/端口每周更改一次,所以我更愿意动态设置连接。因此,目标服务器的那些主机/ IP不是静态的。

我仍然想知道是否有任何方法,而不是[动态ftp示例]为每个tcp/ip连接设置一个全新的applicationContext并修改连接工厂这是非平凡的工作。

我理想的情况是:

<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"/> 

目的主机和端口是邮件标题中。

我知道我的用例很少见,但对我的特定业务逻辑非常有用。我的整个webapp基于来自那些原始tcp-ip连接的消息运行。

回答