package com.usky.demo.service.rocketmq;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.usky.common.core.util.JsonUtils;
import com.usky.demo.service.utils.TsdbUtils;
import com.usky.demo.service.vo.MQDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 中间处理消息转发
 */
@Service
public class SimpleContext {
    @Autowired
    private final Map<String, MqttStrategy> strategyMap = new ConcurrentHashMap<>();

    public SimpleContext(Map<String, MqttStrategy> strategyMap) {
        strategyMap.forEach(this.strategyMap::put);
    }

    public String getResource(MQDataVO mqDataVO) {
        return strategyMap.get(mqDataVO.getDescribe()).disposeMessage(mqDataVO);
    }
}














