Spring整合TCP的一种方法

时间:2019-02-08 08:41:27

标签: java spring tcp client integration

我需要编写一个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)

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

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

0 个答案:

没有答案