java - spring 集成 TCP 一种方式
问题描述
我需要编写一个 tcp 客户端,它只通过 tcp 发送数据,而不是等待响应。我用网关尝试过:
<int:gateway id="TCPgw"
service-interface="org.mypackage.MyClass"
default-request-channel="input"/>
<int-ip:tcp-connection-factory id="TCPClient"
type="client"
host="xxx.xxx.x.xx"
port="xxxx"
single-use="true"
so-timeout="10000"
deserializer="TCPDeserializer"
serializer="TCPSerializer"
ssl-context-support="SslContextSupport"
/>
<int-ip:tcp-outbound-gateway id="TCPclientGateway"
request-channel="input"
connection-factory="TCPClient"
request-timeout="100000"
reply-timeout="100000"/>
<int:channel id="input"/>
这现在有效,但仍在等待响应。
我需要的:
- xml 可配置(如上)
- 没有轮询(我向我展示了 inbound-channel-adapter )
- 只需调用像 send(byte[]) 这样的函数来发送消息。
- (必须支持 SSL)
我阅读了很多教程,但没有找到描述如何设置发送客户端的内容。
我想,我需要使用适配器,但我不知道如何。谢谢
解决方案
推荐阅读
- java - 有没有办法在 Java 中推断泛型类型?
- asp.net - IBM Softlayer (Cloud Load Balancer + SSL OffLoad) ASP.NET too many redirects 错误
- python - python - ctypes opengl函数加载错误(OSError:异常:访问冲突写入0x0000000000000000)
- apache-spark-sql - Spark sql 子查询
- ansible - 将文件夹的全部内容(包括子文件夹)复制到目标
- c++ - C++ MEX 中具有特征矩阵运算的 OpenMP
- javascript - 在 React 中实现分页,每页显示来自 JSON 文件的 15 个项目
- python - 无法使用 errbot 命令创建聊天室,导致 not_allowed_token_type 错误
- xamarin - Xamarin Forms:如何在没有“闪烁”的情况下切换图像?
- python - 如何在 QMainWindow 中显示对象信息