package com.fuyuanshen.global.mqtt.publish;

import com.fuyuanshen.global.mqtt.config.MqttGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.mqtt.support.MqttHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

/**
 * @Author: HarryLin
 * @Date: 2025/3/20  16:16
 * @Company: 北京红山信息科技研究院有限公司
 * @Email: linyun@***.com.cn
 **/
@Service
public class MqttMessageSender {
    @Autowired
    private MqttGateway mqttGateway;
    public void sendMsg(@Header(value = MqttHeaders.TOPIC) String topic, String payload) {
        mqttGateway.sendMsgToMqtt(topic,payload);
    }
    public void sendMsg(@Header(value = MqttHeaders.TOPIC) String topic, @Header(value = MqttHeaders.QOS) int qos, String payload) {
        mqttGateway.sendMsgToMqtt(topic,qos,payload);
    }
}