package com.jay.monitor.data.server.process;

import com.alibaba.fastjson.JSON;
import com.alipay.remoting.BizContext;
import com.jay.monitor.data.core.enums.MsgTypeEnums;
import com.jay.monitor.data.core.model.serializable.MQDataDTO;
import com.jay.monitor.data.server.store.StoreDataManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Module 消息处理
 * @Description 消息队列过来的请求参数
 * @Author liukaixiong
 * @Date 2020/10/23 15:52
 */
@Component
public class MQUserProcess extends AbstractUserProcess<MQDataDTO> {

    private Logger logger = LoggerFactory.getLogger(MQUserProcess.class);

    @Autowired
    private StoreDataManager storeDataManager;

    @Override
    public Object handleRequest0(BizContext bizCtx, MQDataDTO request) throws Exception {
        logger.debug("接收到的URL 传输对象:" + JSON.toJSONString(request));
        return storeDataManager.store(MsgTypeEnums.MQ, request);
    }

    @Override
    public List<String> multiInterest() {
        return getNamesList(MQDataDTO.class);
    }

    @Override
    public ExecutorSelector getExecutorSelector() {
        return super.getExecutorSelector();
    }
}
