首页 > 解决方案 > 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"/>

这现在有效,但仍在等待响应。

我需要的:

我阅读了很多教程,但没有找到描述如何设置发送客户端的内容。

我想,我需要使用适配器,但我不知道如何。谢谢

标签: javaspringtcpclientintegration

解决方案


推荐阅读