1.需求分析
近期笔者项目需要用到mqtt实现消息推送,笔者选择emq作为mqtt服务器载体,上篇笔者讲解了如何在linux中安装mqtt服务:https://blog.csdn.net/zhangxing52077/article/details/80567270,MQTT Demo:https://download.csdn.net/download/zhangxing52077/14167233,接下来笔者将讲解如何在springboot中集成mqtt。
2.实现方案
①pom依赖
<!--mqtt-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integrati