2015-07-21 80 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連接的消息運行。

回答