package com.ruoyi.device.mqtt.listener;

import com.ruoyi.device.mqtt.handler.decoder.MessageHandler;
import jakarta.annotation.Resource;
import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.stereotype.Component;

/**
 * mqtt 设备上行消息处理监听
 *
 * @author lwm
 */
@Component
public class DeviceMessageListener implements IMqttMessageListener
{
    @Resource
    private MessageHandler messageHandler;

    @Override
    public void messageArrived(String topic, MqttMessage message) throws Exception
    {
        messageHandler.handler(topic, message);
    }
}
