spring-integration - 如何强制 TcpNetClientConnectionFactory 打开连接而不发送消息?
问题描述
我的任务是创建一个 Spring 集成 TCP 客户端,该客户端应该连接到服务器并从中接收消息:
- 服务器负责发送“心跳”和数据消息,并且不期望来自客户端的任何传入消息,除了确认。
- 客户端必须打开并维护(重新打开)与服务器的连接。
据我了解,TcpNetClientConnectionFactory
仅在发送消息时才打开连接。有没有办法在不发送任何数据(类似的东西SocketFactory.createSocket(host, port)
)的情况下打开连接并维护它?
解决方案
请调查 aTcpReceivingChannelAdapter
并告诉我们为什么它对您不起作用:
https://docs.spring.io/spring-integration/docs/current/reference/html/ip.html#tcp-adapters
推荐阅读
- python - Python - 使用 Plotly,有没有办法在放大气泡图时显示文本标签?
- java - JScrollPane 中一个位于另一个下方的按钮列表
- javascript - Web 组件转换发生得太晚
- html - `target="_blank"`和右键单击+`在新选项卡中打开链接`之间的Chrome差异
- swift - 相同的约束不同的结果
- sql - 应用程序的数据库结构向用户显示一次随机项目
- javascript - Windows:将 Webrtc 流提供给虚拟驱动程序
- wix - 如何从我的 WiX 安装程序安装 VS Tools For Office Runtime?我正在“等待另一个安装完成”死锁
- c++ - 为什么变量序列在 C++ 中的内存分配中很重要?
- mysql - 是否可以将多行数据传递到 MySQL 子查询而不是使用临时表?