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.ServiceDataDTO;
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 ServiceUserProcess extends AbstractUserProcess<ServiceDataDTO> {

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

    @Autowired
    private StoreDataManager storeDataManager;

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

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

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