Paho 自动重连后订阅的主题会清空,所以需要实现 MqttCallbackExtended 接口,在 connectComplete 方法添加订阅主题;而不是实现 MqttCallback 接口
一、添加引用
1 | <dependency> |
二、添加配置
1 | mqtt: |
三、代码
3.1.客户端
1 | @Configuration |
3.2.订阅者
1 | @Component |
3.3.发布者
1 | @Component |
1 | @RestController |
完整代码:GitHub
参考
Paho 自动重连后订阅的主题会清空,所以需要实现 MqttCallbackExtended 接口,在 connectComplete 方法添加订阅主题;而不是实现 MqttCallback 接口
1 | <dependency> |
1 | mqtt: |
1 | @Configuration |
1 | @Component |
1 | @Component |
1 | @RestController |
完整代码:GitHub
参考
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true