【发布时间】:2015-10-11 14:33:38
【问题描述】:
我知道这是一个类似的问题: Spring Integration. Unknown host and tcp-connection-factory
但是,在我的特定情况下,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"/>
目标主机和端口在消息头中的位置。
我知道我的用例很少见,但它在我的特定业务逻辑中非常有用。我的整个 web 应用程序基于来自这些原始 tcp-ip 连接的消息运行。
【问题讨论】:
标签: spring tcp spring-integration host