Win*_*ins 6 java spring spring-integration spring-java-config
我有以下bean的spring集成XML配置
<int-ip:tcp-outbound-channel-adapter id="outboundClient"
channel="input"
connection-factory="client"/>
Run Code Online (Sandbox Code Playgroud)
我认为java配置中的等价物将是
@ServiceActivator(inputChannel = "input", requiresReply = "true")
public TcpSendingMessageHandler outboundClient() {
TcpSendingMessageHandler tcpSendingMessageHandler = new TcpSendingMessageHandler();
tcpSendingMessageHandler.setConnectionFactory(clientConnectionFactory());
tcpSendingMessageHandler.setRetryInterval(10000);
tcpSendingMessageHandler.setClientMode(true);
return tcpSendingMessageHandler;
}
Run Code Online (Sandbox Code Playgroud)
但是,在日志中,我看到了
TcpListener exiting - no listener and not single use
Run Code Online (Sandbox Code Playgroud)
我无法收到服务器的回复.
任何帮助表示赞赏
这TcpSendingMessageHandler是一种单向使用——仅用于向 TCP 套接字发送消息。
所以,你的配置看起来不错,对我来说它应该可以工作。
TcpListener 退出 - 没有侦听器且不能一次性使用
只是DEBUG来自 的消息TcpNetConnection,表明您的组件是one-way.
因此,您收不到服务器的回复是正常的。因为你只向那里发送消息。
有request/reply场景考虑使用TcpOutboundGateway。
| 归档时间: |
|
| 查看次数: |
1171 次 |
| 最近记录: |