【发布时间】:2016-04-04 06:40:27
【问题描述】:
我有以下要求
- 连接到套接字 (TCP)
- 发送初始化消息[服务器将无响应]
- 检查连接是否有效,如果是,发送轮询消息。
- 如果有响应处理呢。
我正在尝试为 TCP 连接使用 Spring 集成,但是当我尝试执行第二步时,框架会等待响应。有没有办法将其配置为不等待步骤 2 中的响应?
以下是 Spring 配置:
<int:gateway default-request-channel="msOutbound"
service-interface="com.home.tcp.UserService" id="gw" />
<int-ip:tcp-outbound-gateway id="tcpObGw"
connection-factory="client" request-channel="msOutbound"
/>
<int-ip:tcp-connection-factory id="client"
type="client" deserializer="serDeSer" serializer="serDeSer"
host="remoteServer" port="valid port" single-use="true" />
<bean id="serDeSer"
class="org.springframework.integration.ip.tcp.serializer.ByteArrayStxEtxSerializer" />
Java 代码:
service.send("init msg"); // The program exits with no response exception.
service.send("polling message"); //Never executed.
【问题讨论】:
标签: java spring tcp spring-integration