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;


@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);
    }
}