123456789101112131415161718192021 |
- package com.zy.bms.config.mqtt;
- import org.springframework.integration.annotation.MessagingGateway;
- import org.springframework.integration.mqtt.support.MqttHeaders;
- import org.springframework.messaging.handler.annotation.Header;
- import org.springframework.stereotype.Service;
- /**
- * 消息推送接口
- */
- @Service
- @MessagingGateway(defaultRequestChannel = "mqttOutboundChannel")
- public interface MqttGateway {
- /**
- * 向指定主题推送消息
- *
- * @param data 消息
- * @param topic 主题
- */
- void sendMsgToMqtt(String data, @Header(MqttHeaders.TOPIC) String topic);
- }
|