Skip to content

mqtt spring boot 封装,支持注解形式消息订阅,支持同步及异步订阅

License

Notifications You must be signed in to change notification settings

zc-libre/mqtt-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mqtt-spring-boot-starter

MQTT封装 使用方法:

// 消息订阅
@Slf4j
@MqttListener(topic = "test")
public class MqttTestListener implements MqttMessageListener {

	@Override
	public void onMessage(MqttMessage message) {
		log.info("接收到消息, topic: {}, message: {}", message.getTopic(), message);
	}

}
    // 消息发送
    @Autowired
	private MqttMessageGateWay mqttMessageGateWay;

	@Test
	void publish() {
		for (int i = 0; i < 10; i++) {
			mqttMessageGateWay.sendToMqtt("test", "123");
		}

	}

可配置项见MqttProperties

About

mqtt spring boot 封装,支持注解形式消息订阅,支持同步及异步订阅

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages