spring和mqtt集成

2021-06-21 05:05

阅读:342

标签:方法   ESS   www   框架   abs   str   odi   bst   发送   

spring框架和mqtt集成的方式

  借鉴网络上部分开发文档

  配置文件: spring-mtqq.xml

  

  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
  • xmlns:context="http://www.springframework.org/schema/context"
  • xmlns:int-mqtt="http://www.springframework.org/schema/integration/mqtt"
  • xsi:schemaLocation="
  • http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-4.1.xsd
  • http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
  • http://www.springframework.org/schema/integration/mqtt http://www.springframework.org/schema/integration/mqtt/spring-integration-mqtt-4.1.xsd
  • http://www.springframework.org/schema/context
  • http://www.springframework.org/schema/context/spring-context-4.1.xsd">
  • class="org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory">
  • url

  点击查询DefaultMqttPahoClientFactory类将需要的属性配置;

  点击查询MqttPahoMessageHandler、AbstractMqttMessageHandler将需要的属性配置;

  代码调用:

  引入 mqttHandler 调用其handlerMessage(message)方法将Message 消息发送

  

spring和mqtt集成

标签:方法   ESS   www   框架   abs   str   odi   bst   发送   

原文地址:https://www.cnblogs.com/1024ToAdmin/p/9686115.html


评论


亲,登录后才可以留言!